summaryrefslogtreecommitdiff
path: root/libexec/ld.so/sparc64
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2017-01-24 07:48:38 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2017-01-24 07:48:38 +0000
commitc66416e633310f06dfbeaa655d3e2826d4c42dc6 (patch)
tree871022ef5bc45fdadb9027dd35c237840f023803 /libexec/ld.so/sparc64
parenta25395adead1f5541203d945e1c673202a0c6395 (diff)
On fatal errors, kill ourselves with thrkill(0,9,NULL) instead of
simply exiting, via helper functions _dl_die(), _dl_diedie(), and _dl_oom(). prompted by a complaint from jsing@ ok jsing@ deraadt@
Diffstat (limited to 'libexec/ld.so/sparc64')
-rw-r--r--libexec/ld.so/sparc64/archdep.h4
-rw-r--r--libexec/ld.so/sparc64/ldasm.S9
-rw-r--r--libexec/ld.so/sparc64/rtld_machine.c20
-rw-r--r--libexec/ld.so/sparc64/syscall.h4
4 files changed, 19 insertions, 18 deletions
diff --git a/libexec/ld.so/sparc64/archdep.h b/libexec/ld.so/sparc64/archdep.h
index 84217ea7827..15ea156ab65 100644
--- a/libexec/ld.so/sparc64/archdep.h
+++ b/libexec/ld.so/sparc64/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.24 2017/01/21 01:15:00 guenther Exp $ */
+/* $OpenBSD: archdep.h,v 1.25 2017/01/24 07:48:37 guenther Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -45,8 +45,6 @@ RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
if (ELF_R_TYPE(r->r_info) == RELOC_RELATIVE) {
*p = v + r->r_addend;
} else {
- /* XXX - printf might not work here, but we give it a shot. */
- _dl_printf("Unknown bootstrap relocation.\n");
_dl_exit(6);
}
}
diff --git a/libexec/ld.so/sparc64/ldasm.S b/libexec/ld.so/sparc64/ldasm.S
index 31239a93ccd..ab4c77d5669 100644
--- a/libexec/ld.so/sparc64/ldasm.S
+++ b/libexec/ld.so/sparc64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.44 2016/08/28 06:15:33 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.45 2017/01/24 07:48:37 guenther Exp $ */
/* $NetBSD: rtld_start.S,v 1.5 2001/08/14 22:17:48 eeh Exp $ */
/*
@@ -341,3 +341,10 @@ _ENTRY(_dl_pledge)
t ST_SYSCALL ! off to wonderland
retl
sub %g0, %o0, %o0 ! error: result = -errno
+
+_ENTRY(_dl_thrkill)
+ mov SYS_thrkill | SYSCALL_G2RFLAG, %g1 ! calling sys_thrkill
+ add %o7, 8, %g2 ! just return on success
+ t ST_SYSCALL ! off to wonderland
+ retl
+ sub %g0, %o0, %o0 ! error: result = -errno
diff --git a/libexec/ld.so/sparc64/rtld_machine.c b/libexec/ld.so/sparc64/rtld_machine.c
index fc1b49c3d3f..dd22ec0fa28 100644
--- a/libexec/ld.so/sparc64/rtld_machine.c
+++ b/libexec/ld.so/sparc64/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.58 2016/06/21 15:25:38 deraadt Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.59 2017/01/24 07:48:37 guenther Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -225,10 +225,8 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
if (relas == NULL)
return(0);
- if (relrel > numrela) {
- _dl_printf("relacount > numrel: %ld > %ld\n", relrel, numrela);
- _dl_exit(20);
- }
+ if (relrel > numrela)
+ _dl_die("relacount > numrel: %ld > %ld", relrel, numrela);
/*
* unprotect some segments if we need it.
@@ -246,10 +244,8 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
Elf_Addr *where;
#ifdef DEBUG
- if (ELF_R_TYPE(relas->r_info) != R_TYPE(RELATIVE)) {
- _dl_printf("RELACOUNT wrong\n");
- _dl_exit(20);
- }
+ if (ELF_R_TYPE(relas->r_info) != R_TYPE(RELATIVE))
+ _dl_die("RELACOUNT wrong");
#endif
where = (Elf_Addr *)(relas->r_offset + loff);
*where = relas->r_addend + loff;
@@ -639,10 +635,8 @@ _dl_bind(elf_object_t *object, int index)
this = NULL;
ooff = _dl_find_symbol(symn, &this,
SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_PLT, sym, object, &sobj);
- if (this == NULL) {
- _dl_printf("lazy binding failed!\n");
- *(volatile int *)0 = 0; /* XXX */
- }
+ if (this == NULL)
+ _dl_die("lazy binding failed!");
newvalue = ooff + this->st_value;
diff --git a/libexec/ld.so/sparc64/syscall.h b/libexec/ld.so/sparc64/syscall.h
index f756b6da1d8..1ed7bcd846d 100644
--- a/libexec/ld.so/sparc64/syscall.h
+++ b/libexec/ld.so/sparc64/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.36 2017/01/21 01:15:00 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.37 2017/01/24 07:48:37 guenther Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -57,6 +57,8 @@ int _dl_getcwd(char *, size_t);
int _dl_utrace(const char *, const void *, size_t);
int _dl_getentropy(char *, size_t);
int _dl_sendsyslog(const char *, size_t, int);
+__dead
+void _dl_thrkill(pid_t, int, void *);
static inline void *
_dl_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)