summaryrefslogtreecommitdiff
path: root/libexec/ld.so/arm
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/arm
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/arm')
-rw-r--r--libexec/ld.so/arm/archdep.h4
-rw-r--r--libexec/ld.so/arm/ldasm.S3
-rw-r--r--libexec/ld.so/arm/rtld_machine.c26
-rw-r--r--libexec/ld.so/arm/syscall.h4
4 files changed, 15 insertions, 22 deletions
diff --git a/libexec/ld.so/arm/archdep.h b/libexec/ld.so/arm/archdep.h
index 20f45811f24..7ccdd1dc068 100644
--- a/libexec/ld.so/arm/archdep.h
+++ b/libexec/ld.so/arm/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.11 2017/01/21 01:15:00 guenther Exp $ */
+/* $OpenBSD: archdep.h,v 1.12 2017/01/24 07:48:37 guenther Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -53,8 +53,6 @@ RELOC_DYN(Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v)
} else if (ELF_R_TYPE(r->r_info) == R_ARM_ABS32) {
*p += v + s->st_value;
} 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/arm/ldasm.S b/libexec/ld.so/arm/ldasm.S
index 90e1acaf7c2..5d09a1cb623 100644
--- a/libexec/ld.so/arm/ldasm.S
+++ b/libexec/ld.so/arm/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.24 2016/08/28 06:15:32 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.25 2017/01/24 07:48:37 guenther Exp $ */
/*
* Copyright (c) 2004 Dale Rahn
@@ -134,6 +134,7 @@ DL_SYSCALL(pledge)
DL_SYSCALL2(getcwd,__getcwd)
DL_SYSCALL(sysctl)
DL_SYSCALL2(set_tcb,__set_tcb)
+DL_SYSCALL(thrkill)
DL_SYSCALL(getdents)
diff --git a/libexec/ld.so/arm/rtld_machine.c b/libexec/ld.so/arm/rtld_machine.c
index eebe35483b5..ec66b58f015 100644
--- a/libexec/ld.so/arm/rtld_machine.c
+++ b/libexec/ld.so/arm/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.24 2017/01/23 10:30:58 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.25 2017/01/24 07:48:37 guenther Exp $ */
/*
* Copyright (c) 2004 Dale Rahn
@@ -180,10 +180,8 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz)
if (rels == NULL)
return(0);
- if (relrel > numrel) {
- _dl_printf("relcount > numrel: %ld > %ld\n", relrel, numrel);
- _dl_exit(20);
- }
+ if (relrel > numrel)
+ _dl_die("relcount > numrel: %ld > %ld", relrel, numrel);
/*
* unprotect some segments if we need it.
@@ -203,10 +201,8 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz)
Elf_Addr *where;
#ifdef DEBUG
- if (ELF_R_TYPE(rels->r_info) != R_TYPE(RELATIVE)) {
- _dl_printf("RELCOUNT wrong\n");
- _dl_exit(20);
- }
+ if (ELF_R_TYPE(rels->r_info) != R_TYPE(RELATIVE))
+ _dl_die("RELCOUNT wrong");
#endif
where = (Elf_Addr *)(rels->r_offset + loff);
*where += loff;
@@ -219,10 +215,8 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz)
type = ELF_R_TYPE(rels->r_info);
- if (reloc_target_flags[type] & _RF_E) {
- _dl_printf(" bad relocation %ld %d\n", i, type);
- _dl_exit(1);
- }
+ if (reloc_target_flags[type] & _RF_E)
+ _dl_die("bad relocation %ld %d", i, type);
if (type == R_TYPE(NONE))
continue;
@@ -407,10 +401,8 @@ _dl_bind(elf_object_t *object, int relidx)
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;
diff --git a/libexec/ld.so/arm/syscall.h b/libexec/ld.so/arm/syscall.h
index 280d1474983..990adee20bd 100644
--- a/libexec/ld.so/arm/syscall.h
+++ b/libexec/ld.so/arm/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.24 2017/01/21 01:15:00 guenther Exp $ */
+/* $OpenBSD: syscall.h,v 1.25 2017/01/24 07:48:37 guenther Exp $ */
/*
* Copyright (c) 2001 Niklas Hallqvist
@@ -58,6 +58,8 @@ int _dl_utrace(const char *, const void *, size_t);
int _dl_getentropy(char *, size_t);
int _dl_sendsyslog(const char *, size_t, int);
void _dl_set_tcb(void *);
+__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)