summaryrefslogtreecommitdiff
path: root/libexec/ld.so/alpha
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/alpha
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/alpha')
-rw-r--r--libexec/ld.so/alpha/archdep.h3
-rw-r--r--libexec/ld.so/alpha/ldasm.S3
-rw-r--r--libexec/ld.so/alpha/rtld_machine.c26
-rw-r--r--libexec/ld.so/alpha/syscall.h4
4 files changed, 15 insertions, 21 deletions
diff --git a/libexec/ld.so/alpha/archdep.h b/libexec/ld.so/alpha/archdep.h
index 6bac4b9758f..36720e0d4d6 100644
--- a/libexec/ld.so/alpha/archdep.h
+++ b/libexec/ld.so/alpha/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.19 2017/01/20 10:40:30 guenther Exp $ */
+/* $OpenBSD: archdep.h,v 1.20 2017/01/24 07:48:37 guenther Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -53,7 +53,6 @@ RELOC_DYN(Elf64_Rela *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v)
} else if (ELF64_R_TYPE(r->r_info) == RELOC_GLOB_DAT) {
*p = v + s->st_value + r->r_addend;
} else {
- _dl_printf("unknown bootstrap relocation\n");
_dl_exit(6);
}
}
diff --git a/libexec/ld.so/alpha/ldasm.S b/libexec/ld.so/alpha/ldasm.S
index 68b68fc419c..f447f2f37ae 100644
--- a/libexec/ld.so/alpha/ldasm.S
+++ b/libexec/ld.so/alpha/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.38 2016/08/31 13:18:57 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.39 2017/01/24 07:48:37 guenther Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -325,5 +325,6 @@ DL_SYSCALL(read)
DL_SYSCALL(readlink)
DL_SYSCALL2(_syscall,__syscall)
DL_SYSCALL(sysctl)
+DL_SYSCALL(thrkill)
DL_SYSCALL(utrace)
DL_SYSCALL(write)
diff --git a/libexec/ld.so/alpha/rtld_machine.c b/libexec/ld.so/alpha/rtld_machine.c
index 4a3fc307faf..21eb71213d3 100644
--- a/libexec/ld.so/alpha/rtld_machine.c
+++ b/libexec/ld.so/alpha/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.59 2016/06/21 15:25:36 deraadt Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.60 2017/01/24 07:48:37 guenther Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -69,10 +69,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.
@@ -93,10 +91,8 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
Elf_Addr *r_addr;
#ifdef DEBUG
- if (ELF64_R_TYPE(relas->r_info) != R_TYPE(RELATIVE)) {
- _dl_printf("RELACOUNT wrong\n");
- _dl_exit(20);
- }
+ if (ELF64_R_TYPE(relas->r_info) != R_TYPE(RELATIVE))
+ _dl_die("RELACOUNT wrong");
#endif
r_addr = (Elf64_Addr *)(relas->r_offset + loff);
@@ -180,11 +176,9 @@ _dl_printf("unaligned RELATIVE: %p type: %d %s 0x%lx -> 0x%lx\n", r_addr,
case R_TYPE(NONE):
break;
default:
- _dl_printf("%s:"
- " %s: unsupported relocation '%s' %d at %lx\n",
- __progname, object->load_name, symn,
+ _dl_die("%s: unsupported relocation '%s' %d at %lx",
+ object->load_name, symn,
ELF64_R_TYPE(relas->r_info), r_addr );
- _dl_exit(1);
}
continue;
resolve_failed:
@@ -230,10 +224,8 @@ _dl_bind(elf_object_t *object, int reloff)
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!");
buf.newval = ooff + this->st_value + rela->r_addend;
diff --git a/libexec/ld.so/alpha/syscall.h b/libexec/ld.so/alpha/syscall.h
index 49203b0b761..4446d2bcbf2 100644
--- a/libexec/ld.so/alpha/syscall.h
+++ b/libexec/ld.so/alpha/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.37 2017/01/21 01:15:00 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.38 2017/01/24 07:48:37 guenther Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -57,5 +57,7 @@ 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 *);
#endif /*__DL_SYSCALL_H__*/