From: deraadt Date: Sat, 18 Nov 2023 16:26:15 +0000 (+0000) Subject: crt0 uses a helper function in a MD src/libexec/ld.so .h file (rather than X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1e43641e997f17b3e752e4bc940b17070ff580a3;p=openbsd 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 --- diff --git a/lib/csu/aarch64/md_init.h b/lib/csu/aarch64/md_init.h index 71356c6e93c..c02b804f407 100644 --- a/lib/csu/aarch64/md_init.h +++ b/lib/csu/aarch64/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.11 2023/03/31 18:46:24 kettenis Exp $ */ +/* $OpenBSD: md_init.h,v 1.12 2023/11/18 16:26:16 deraadt Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -112,10 +112,6 @@ " \n" \ " b ___start \n" \ " \n" \ - "_dl_exit: \n" \ - " mov x8, #" STR(SYS_exit) " \n" \ - " svc #0 \n" \ - " dsb nsh \n" \ - " isb \n" \ + "_csu_abort: \n" \ " udf #0 \n" \ ".previous"); diff --git a/lib/csu/alpha/md_init.h b/lib/csu/alpha/md_init.h index d503c751913..76c80b2d561 100644 --- a/lib/csu/alpha/md_init.h +++ b/lib/csu/alpha/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.12 2020/10/15 16:30:23 deraadt Exp $ */ +/* $OpenBSD: md_init.h,v 1.13 2023/11/18 16:26:16 deraadt Exp $ */ /*- * Copyright (c) 2001 Ross Harvey * All rights reserved. @@ -95,11 +95,9 @@ " mov $9, $16 \n" \ " mov 0, $17 \n" \ " jsr $26, ___start \n" \ - ".globl _dl_exit \n" \ - ".type _dl_exit@function \n" \ - "_dl_exit: \n" \ - " lda $0, " STR(SYS_exit) " \n" \ - " callsys \n" \ + ".globl _csu_abort \n" \ + ".type _csu_abort@function \n" \ + "_csu_abort: \n" \ " halt ") #define MD_START_ARGS char **sp, void (*cleanup)(void) diff --git a/lib/csu/amd64/md_init.h b/lib/csu/amd64/md_init.h index 948e7c928bb..fa9e812c87d 100644 --- a/lib/csu/amd64/md_init.h +++ b/lib/csu/amd64/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.10 2023/04/25 04:10:21 deraadt Exp $ */ +/* $OpenBSD: md_init.h,v 1.11 2023/11/18 16:26:16 deraadt Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -107,12 +107,10 @@ " addq $8,%rsp \n" \ " jmp ___start \n" \ " \n" \ - " .global _dl_exit \n" \ - " .type _dl_exit,@function \n" \ + " .global _csu_abort \n" \ + " .type _csu_abort,@function \n" \ " .align 8 \n" \ - "_dl_exit: \n" \ + "_csu_abort: \n" \ " endbr64 \n" \ - " movl $ " STR(SYS_exit) ", %eax \n" \ - " syscall \n" \ " int3 \n" \ " .previous") diff --git a/lib/csu/arm/md_init.h b/lib/csu/arm/md_init.h index 3a9b581b6dc..63bfc8bee1d 100644 --- a/lib/csu/arm/md_init.h +++ b/lib/csu/arm/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.17 2020/10/19 17:57:40 naddy Exp $ */ +/* $OpenBSD: md_init.h,v 1.18 2023/11/18 16:26:16 deraadt Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -154,10 +154,6 @@ ".L__DYNAMIC: \n" \ " .long _DYNAMIC(GOTOFF) \n" \ " \n" \ - "_dl_exit: \n" \ - " mov r12, #" STR(SYS_exit) " \n" \ - " swi #0 \n" \ - " dsb nsh \n" \ - " isb \n" \ + "_csu_abort: \n" \ " udf #0 \n" \ ".previous"); diff --git a/lib/csu/boot.h b/lib/csu/boot.h index 72cbfee007b..da6d424bdeb 100644 --- a/lib/csu/boot.h +++ b/lib/csu/boot.h @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.h,v 1.34 2022/10/21 18:14:09 deraadt Exp $ */ +/* $OpenBSD: boot.h,v 1.35 2023/11/18 16:26:15 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -40,7 +40,7 @@ #include __dead -void _dl_exit(int); +void _csu_abort(void); #include "archdep.h" diff --git a/lib/csu/hppa/boot_md.h b/lib/csu/hppa/boot_md.h index a770f7af4bb..0a8f4060781 100644 --- a/lib/csu/hppa/boot_md.h +++ b/lib/csu/hppa/boot_md.h @@ -1,4 +1,4 @@ -/* $OpenBSD: boot_md.h,v 1.4 2022/10/27 19:40:21 deraadt Exp $ */ +/* $OpenBSD: boot_md.h,v 1.5 2023/11/18 16:26:16 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -40,7 +40,7 @@ #include __dead -void _dl_exit(int); +void _csu_abort(void); #include "archdep.h" diff --git a/lib/csu/hppa/md_init.h b/lib/csu/hppa/md_init.h index 5abe6daff30..7b0813e18fe 100644 --- a/lib/csu/hppa/md_init.h +++ b/lib/csu/hppa/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.15 2020/10/15 16:30:23 deraadt Exp $ */ +/* $OpenBSD: md_init.h,v 1.16 2023/11/18 16:26:16 deraadt Exp $ */ /* * Copyright (c) 2003 Dale Rahn. All rights reserved. @@ -137,17 +137,13 @@ " copy %dp, %r19 \n" \ " .exit \n" \ " .procend \n" \ - " .export _dl_exit, entry \n" \ - " .type _dl_exit,@function \n" \ - " .label _dl_exit \n" \ + " .export _csu_abort, entry \n" \ + " .type _csu_abort,@function \n" \ + " .label _csu_abort \n" \ " .proc \n" \ " .callinfo frame=0, calls \n" \ " .entry \n" \ - "_dl_exit: \n" \ - " stw %rp, -24(%sp) \n" \ - " ldil L%0xc0000000, %r1 \n" \ - " ble 4(%sr7, %r1) \n" \ - " ldi " STR(SYS_exit) ", %t1 \n" \ + "_csu_abort: \n" \ " break 0,0 \n" \ " .exit \n" \ " .procend") diff --git a/lib/csu/i386/md_init.h b/lib/csu/i386/md_init.h index efd601d12bc..f401328e79e 100644 --- a/lib/csu/i386/md_init.h +++ b/lib/csu/i386/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.12 2023/04/25 04:06:06 deraadt Exp $ */ +/* $OpenBSD: md_init.h,v 1.13 2023/11/18 16:26:16 deraadt Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -114,10 +114,8 @@ " call ___start # ___start(argc,argv,envp,0) \n" \ " \n" \ " .align 4 \n" \ - " .globl _dl_exit \n" \ - " .type _dl_exit,@function \n" \ - "_dl_exit: \n" \ - " mov $" STR(SYS_exit) ", %eax\n" \ - " int $0x80 \n" \ + " .globl _csu_abort \n" \ + " .type _csu_abort,@function \n" \ + "_csu_abort: \n" \ " int3 \n" \ " .previous") diff --git a/lib/csu/m88k/md_init.h b/lib/csu/m88k/md_init.h index f73ed3e23bf..6f37b9d2f6f 100644 --- a/lib/csu/m88k/md_init.h +++ b/lib/csu/m88k/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.9 2020/10/15 16:30:23 deraadt Exp $ */ +/* $OpenBSD: md_init.h,v 1.10 2023/11/18 16:26:16 deraadt Exp $ */ /* * Copyright (c) 2012 Miodrag Vallat. @@ -99,9 +99,6 @@ " addu %r4, %r4, 4 \n" \ " /* envp = argv + argc + 1 */ \n" \ \ - "_dl_exit: \n" \ - " or %r13, %r0, " STR(SYS_exit) " \n" \ - " tb0 0, %r0, 450 \n" \ - " or %r0, %r0, %r0 \n" \ + "_csu_abort: \n" \ " tb0 0, %r0, 130 /* breakpoint */ \n" \ " .previous"); diff --git a/lib/csu/mips64/boot_md.h b/lib/csu/mips64/boot_md.h index 09fb17f4d6f..8c2f6ec417a 100644 --- a/lib/csu/mips64/boot_md.h +++ b/lib/csu/mips64/boot_md.h @@ -1,4 +1,4 @@ -/* $OpenBSD: boot_md.h,v 1.3 2022/10/27 19:40:23 deraadt Exp $ */ +/* $OpenBSD: boot_md.h,v 1.4 2023/11/18 16:26:16 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -40,7 +40,7 @@ #include __dead -void _dl_exit(int); +void _csu_abort(int); #include "archdep.h" diff --git a/lib/csu/mips64/md_init.h b/lib/csu/mips64/md_init.h index ad4e70af95d..0f5045d4a0b 100644 --- a/lib/csu/mips64/md_init.h +++ b/lib/csu/mips64/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.20 2020/10/20 15:26:59 visa Exp $ */ +/* $OpenBSD: md_init.h,v 1.21 2023/11/18 16:26:16 deraadt Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -140,14 +140,12 @@ " dla $t9, ___start \n" \ " jr $t9 \n" \ " .end __start \n" \ - " .globl _dl_exit \n" \ - " .ent _dl_exit \n" \ - " .type _dl_exit, @function \n" \ - "_dl_exit: \n" \ - " li $v0, " STR(SYS_exit) " \n" \ - " syscall \n" \ - " teq $zero, $zero, 0x52 \n" \ - " .end _dl_exit \n" \ + " .globl _csu_abort \n" \ + " .ent _csu_abort \n" \ + " .type _csu_abort, @function \n" \ + "_csu_abort: \n" \ + " teq zero, zero, 0x52 \n" \ + " .end _csu_abort \n" \ " .previous") struct kframe { diff --git a/lib/csu/powerpc/md_init.h b/lib/csu/powerpc/md_init.h index fa4a3f514fb..7c206e640b2 100644 --- a/lib/csu/powerpc/md_init.h +++ b/lib/csu/powerpc/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.11 2020/10/15 16:30:23 deraadt Exp $ */ +/* $OpenBSD: md_init.h,v 1.12 2023/11/18 16:26:16 deraadt Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -119,10 +119,8 @@ __asm( \ " \n" \ " .text \n" \ " .align 2 \n" \ -" .globl _dl_exit \n" \ -" .type _dl_exit, @function \n" \ -"_dl_exit: \n" \ -" li %r0, " STR(SYS_exit) " \n" \ -" sc \n" \ +" .globl _csu_abort \n" \ +" .type _csu_abort, @function \n" \ +"_csu_abort: \n" \ " .long 0 # illegal \n" \ ) diff --git a/lib/csu/powerpc64/md_init.h b/lib/csu/powerpc64/md_init.h index e2054bd5754..110cc5b2ed6 100644 --- a/lib/csu/powerpc64/md_init.h +++ b/lib/csu/powerpc64/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.4 2020/10/15 16:30:23 deraadt Exp $ */ +/* $OpenBSD: md_init.h,v 1.5 2023/11/18 16:26:16 deraadt Exp $ */ /* * Copyright (c) 2020 Dale Rahn @@ -111,10 +111,8 @@ __asm( \ " li %r6, 0 \n" \ " bl ___start \n" \ " \n" \ -" .globl _dl_exit \n" \ -" .type _dl_exit, @function \n" \ -"_dl_exit: \n" \ -" li %r0, " STR(SYS_exit) " \n" \ -" sc \n" \ +" .globl _csu_abort \n" \ +" .type _csu_abort, @function \n" \ +"_csu_abort: \n" \ " .long 0 # illegal \n" \ ) diff --git a/lib/csu/riscv64/md_init.h b/lib/csu/riscv64/md_init.h index 1f454384c58..62bf4638547 100644 --- a/lib/csu/riscv64/md_init.h +++ b/lib/csu/riscv64/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.3 2021/07/22 18:16:13 kettenis Exp $ */ +/* $OpenBSD: md_init.h,v 1.4 2023/11/18 16:26:16 deraadt Exp $ */ /* * Copyright (c) 2020 Dale Rahn * @@ -107,8 +107,6 @@ " j ___start \n" \ " .size _start, .-_start \n" \ " .size __start, .-__start \n" \ - "_dl_exit: \n" \ - " li t0, " STR(SYS_exit) " \n" \ - " ecall \n" \ + "_csu_abort: \n" \ " unimp \n" \ ".previous"); diff --git a/lib/csu/sh/md_init.h b/lib/csu/sh/md_init.h index f2940122c4a..b75014616d5 100644 --- a/lib/csu/sh/md_init.h +++ b/lib/csu/sh/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.10 2020/10/15 16:30:23 deraadt Exp $ */ +/* $OpenBSD: md_init.h,v 1.11 2023/11/18 16:26:16 deraadt Exp $ */ /* $NetBSD: dot_init.h,v 1.3 2005/12/24 22:02:10 perry Exp $ */ /*- @@ -131,10 +131,8 @@ __asm(".section " #section "\n" \ " .long _DYNAMIC - .L_offbase \n" \ \ " .align 2 \n" \ - " .globl _dl_exit \n" \ - " .type _dl_exit,@function \n" \ - "_dl_exit: \n" \ - " mov #" STR(SYS_exit) ", r0 \n" \ - " .word 0xc380 /* trapa #0x80 */ \n" \ + " .globl _csu_abort \n" \ + " .type _csu_abort,@function \n" \ + "_csu_abort: \n" \ " sleep /* illegal */ \n" \ ".previous") diff --git a/lib/csu/sparc64/md_init.h b/lib/csu/sparc64/md_init.h index 09f0f0cc1ec..7857bacdf23 100644 --- a/lib/csu/sparc64/md_init.h +++ b/lib/csu/sparc64/md_init.h @@ -1,4 +1,4 @@ -/* $OpenBSD: md_init.h,v 1.9 2020/10/15 16:30:23 deraadt Exp $ */ +/* $OpenBSD: md_init.h,v 1.10 2023/11/18 16:26:16 deraadt Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -100,10 +100,8 @@ " ba,pt %icc, ___start \n" \ " clr %o1 \n" \ " \n" \ - " .global _dl_exit \n" \ - "_dl_exit: \n" \ - " mov " STR(SYS_exit) ", %g1 \n" \ - " t 0 \n" \ + " .global _csu_abort \n" \ + "_csu_abort: \n" \ " unimp \n" \ " .previous") 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 @@ -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(); } }