diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2023-11-18 16:26:18 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2023-11-18 16:26:18 +0000 |
commit | eebaec8bf69b2db1088ab7a84b8bc96a3d02473e (patch) | |
tree | 01c4cdb241357ce61e341e655dd01bce0c5d750d /libexec/ld.so | |
parent | 9039430940e09de13f4467d9fd1a12296a6746f4 (diff) |
crt0 uses a helper function in a MD src/libexec/ld.so .h file (rather than
reproducing the relevant defines and code in a different place) to perform
minor relocations. If things go very wrong, it would call _dl_exit() --
a locally defined crt0 function which is syscall exit(2). We don't need
to call exit(2) for this obscure case which doesn't happen and provides no
debugging information. An 'abort' is going to provide better information.
So let's change the function name to _dso_abort() and make it a single
illegal instruction.
ok guenther
Diffstat (limited to 'libexec/ld.so')
-rw-r--r-- | libexec/ld.so/aarch64/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/alpha/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/amd64/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/arm/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/hppa/archdep.h | 6 | ||||
-rw-r--r-- | libexec/ld.so/i386/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/m88k/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/mips64/archdep.h | 6 | ||||
-rw-r--r-- | libexec/ld.so/powerpc/archdep.h | 6 | ||||
-rw-r--r-- | libexec/ld.so/powerpc64/archdep.h | 6 | ||||
-rw-r--r-- | libexec/ld.so/riscv64/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/sh/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/sparc64/archdep.h | 4 |
13 files changed, 30 insertions, 30 deletions
diff --git a/libexec/ld.so/aarch64/archdep.h b/libexec/ld.so/aarch64/archdep.h index 8e6fa7d9259..80411488917 100644 --- a/libexec/ld.so/aarch64/archdep.h +++ b/libexec/ld.so/aarch64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.8 2022/01/17 01:35:36 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.9 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -45,7 +45,7 @@ RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } else if (ELF_R_TYPE(r->r_info) == R_AARCH64_ABS64) { *p = v + s->st_value + r->r_addend; } else { - _dl_exit(6); + _csu_abort(); } } diff --git a/libexec/ld.so/alpha/archdep.h b/libexec/ld.so/alpha/archdep.h index f952fea5252..4590afc8956 100644 --- a/libexec/ld.so/alpha/archdep.h +++ b/libexec/ld.so/alpha/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.25 2022/01/31 05:44:13 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.26 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -50,7 +50,7 @@ RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } else if (ELF_R_TYPE(r->r_info) == RELOC_GLOB_DAT) { *p = v + s->st_value + r->r_addend; } else { - _dl_exit(6); + _csu_abort(); } } diff --git a/libexec/ld.so/amd64/archdep.h b/libexec/ld.so/amd64/archdep.h index f717f9c7ee8..415056dea41 100644 --- a/libexec/ld.so/amd64/archdep.h +++ b/libexec/ld.so/amd64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.15 2022/01/17 01:35:36 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.16 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -45,7 +45,7 @@ RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } else if (ELF_R_TYPE(r->r_info) == R_X86_64_64) { *p = v + s->st_value + r->r_addend; } else { - _dl_exit(6); + _csu_abort(); } } diff --git a/libexec/ld.so/arm/archdep.h b/libexec/ld.so/arm/archdep.h index c6adff41b85..7d23f0a9b82 100644 --- a/libexec/ld.so/arm/archdep.h +++ b/libexec/ld.so/arm/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.15 2022/01/17 01:35:36 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.16 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -45,7 +45,7 @@ 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 { - _dl_exit(6); + _csu_abort(); } } diff --git a/libexec/ld.so/hppa/archdep.h b/libexec/ld.so/hppa/archdep.h index 6aa05877c79..52676803ba6 100644 --- a/libexec/ld.so/hppa/archdep.h +++ b/libexec/ld.so/hppa/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.18 2022/01/31 05:43:22 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.19 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 2004 Michael Shalayeff @@ -49,7 +49,7 @@ RELOC_JMPREL(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v, p[0] = v + s->st_value + r->r_addend; p[1] = pltgot; } else { - _dl_exit(5); + _csu_abort(); } } @@ -64,7 +64,7 @@ RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } else if (ELF_R_TYPE(r->r_info) == RELOC_PLABEL32) { *p = v + s->st_value + r->r_addend; } else { - _dl_exit(6); + _csu_abort(); } } diff --git a/libexec/ld.so/i386/archdep.h b/libexec/ld.so/i386/archdep.h index 65dcaab019b..e5a9c772b2c 100644 --- a/libexec/ld.so/i386/archdep.h +++ b/libexec/ld.so/i386/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.23 2022/01/17 01:35:36 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.24 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -46,7 +46,7 @@ RELOC_DYN(const Elf_Rel *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } else if (ELF_R_TYPE(r->r_info) == RELOC_32) { *p += v + s->st_value; } else { - _dl_exit(6); + _csu_abort(); } } diff --git a/libexec/ld.so/m88k/archdep.h b/libexec/ld.so/m88k/archdep.h index fa16862117f..c22bbd2177e 100644 --- a/libexec/ld.so/m88k/archdep.h +++ b/libexec/ld.so/m88k/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.10 2022/01/16 02:14:27 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.11 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -43,7 +43,7 @@ RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } else if (ELF_R_TYPE(r->r_info) == RELOC_32) { *p = v + s->st_value + r->r_addend; } else if (ELF_R_TYPE(r->r_info) != RELOC_NONE) { - _dl_exit(ELF_R_TYPE(r->r_info) + 100); + _csu_abort(); } } diff --git a/libexec/ld.so/mips64/archdep.h b/libexec/ld.so/mips64/archdep.h index 386765ea44b..957527b08ac 100644 --- a/libexec/ld.so/mips64/archdep.h +++ b/libexec/ld.so/mips64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.17 2022/01/17 19:45:34 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.18 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 1998-2002 Opsycon AB, Sweden. @@ -45,7 +45,7 @@ do { \ else \ *adrp += val; \ } else if (ELF_R_TYPE(relp->r_info) != R_MIPS_NONE) { \ - _dl_exit(ELF_R_TYPE(relp->r_info)+100); \ + _csu_abort(); \ } \ } while (0) @@ -76,7 +76,7 @@ do { \ if (sp->st_shndx == SHN_UNDEF || \ sp->st_shndx == SHN_COMMON) { \ if (ELF_ST_BIND(sp->st_info) != STB_WEAK) \ - _dl_exit(7); \ + _csu_abort(); \ } else if (ELF_ST_TYPE(sp->st_info) == STT_FUNC) { \ *gotp += __loff; \ } else { \ diff --git a/libexec/ld.so/powerpc/archdep.h b/libexec/ld.so/powerpc/archdep.h index 678672bf010..5f26d7290d8 100644 --- a/libexec/ld.so/powerpc/archdep.h +++ b/libexec/ld.so/powerpc/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.25 2022/01/17 01:35:36 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.26 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -58,7 +58,7 @@ RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) if (((val & 0xfe000000) != 0) && ((val & 0xfe000000) != 0xfe000000)) { /* invalid offset */ - _dl_exit(20); + _csu_abort(); } val &= ~0xfc000000; val |= 0x48000000; @@ -67,7 +67,7 @@ RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } else if (ELF_R_TYPE((r)->r_info) == RELOC_GLOB_DAT) { *p = v + s->st_value + r->r_addend; } else { - _dl_exit(6); + _csu_abort(); } } diff --git a/libexec/ld.so/powerpc64/archdep.h b/libexec/ld.so/powerpc64/archdep.h index b27d9a74c49..93cff9e49d9 100644 --- a/libexec/ld.so/powerpc64/archdep.h +++ b/libexec/ld.so/powerpc64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.4 2022/01/16 02:16:40 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.5 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -59,7 +59,7 @@ RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) if (((val & 0xfe000000) != 0) && ((val & 0xfe000000) != 0xfe000000)) { /* invalid offset */ - _dl_exit(20); + _csu_abort(); } val &= ~0xfc000000; val |= 0x48000000; @@ -68,7 +68,7 @@ RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } else if (ELF_R_TYPE((r)->r_info) == R_PPC64_GLOB_DAT) { *p = v + s->st_value + r->r_addend; } else { - _dl_exit(6); + _csu_abort(); } } diff --git a/libexec/ld.so/riscv64/archdep.h b/libexec/ld.so/riscv64/archdep.h index 5e090c73a82..8c85c83af8f 100644 --- a/libexec/ld.so/riscv64/archdep.h +++ b/libexec/ld.so/riscv64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.4 2022/01/16 02:17:05 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.5 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 2021 Dale Rahn <drahn@openbsd.org> @@ -44,7 +44,7 @@ RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } else if (ELF_R_TYPE(r->r_info) == R_RISCV_64) { *p = v + s->st_value + r->r_addend; } else { - _dl_exit(6); + _csu_abort(); } } diff --git a/libexec/ld.so/sh/archdep.h b/libexec/ld.so/sh/archdep.h index d56c32bad07..0a3c6c4f813 100644 --- a/libexec/ld.so/sh/archdep.h +++ b/libexec/ld.so/sh/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.14 2022/01/17 01:35:36 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.15 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -43,7 +43,7 @@ RELOC_DYN(const Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) } else if (ELF_R_TYPE(r->r_info) == R_SH_DIR32) { *p = s->st_value + v + r->r_addend; } else { - _dl_exit(6); + _csu_abort(); } } diff --git a/libexec/ld.so/sparc64/archdep.h b/libexec/ld.so/sparc64/archdep.h index 3a7b2d58ddd..e4c57b71171 100644 --- a/libexec/ld.so/sparc64/archdep.h +++ b/libexec/ld.so/sparc64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.28 2022/01/17 01:35:36 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.29 2023/11/18 16:26:17 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -41,7 +41,7 @@ RELOC_DYN(const 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 { - _dl_exit(6); + _csu_abort(); } } |