public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "palmer at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/31317] [RISCV] static PIE crashes during self relocation Date: Thu, 22 Feb 2024 18:44:05 +0000 [thread overview] Message-ID: <bug-31317-131-UAFmGgv251@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-31317-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=31317 Palmer Dabbelt <palmer at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |palmer at gcc dot gnu.org --- Comment #1 from Palmer Dabbelt <palmer at gcc dot gnu.org> --- IIUC this is an ABI grey area. I guess we could write down this as a requirement and then call it a mold bug, but it seems better to just stop taking advantage of the behavior if we can. I guess something like diff --git a/sysdeps/riscv/dl-machine.h b/sysdeps/riscv/dl-machine.h index 0cbb476c05..a540760f6f 100644 --- a/sysdeps/riscv/dl-machine.h +++ b/sysdeps/riscv/dl-machine.h @@ -348,7 +348,7 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], gotplt[1] = (ElfW(Addr)) l; } - if (l->l_type == lt_executable && l->l_scope != NULL) + if (l->l_type == lt_executable && l->l_relocated && l->l_scope != NULL) { /* The __global_pointer$ may not be defined by the linker if the $gp register does not be used to access the global variable would squash the crash. Maybe that's good enough for static-PIE? We also load up GP in _start, and it's not like MIPS where we have per-object GP values so I think we should be safe? -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2024-02-22 18:44 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-30 13:25 [Bug dynamic-link/31317] New: " schwab@linux-m68k.org 2024-02-22 18:44 ` palmer at gcc dot gnu.org [this message] 2024-02-22 21:47 ` [Bug dynamic-link/31317] " schwab@linux-m68k.org 2024-02-22 22:53 ` palmer at gcc dot gnu.org 2024-02-22 23:01 ` vineet.gupta at linux dot dev 2024-02-22 23:16 ` schwab@linux-m68k.org 2024-02-22 23:26 ` palmer at gcc dot gnu.org 2024-02-23 3:06 ` yanzhang.wang at intel dot com 2024-03-06 14:44 ` rjones at redhat dot com 2024-03-25 14:20 ` cvs-commit at gcc dot gnu.org 2024-03-26 13:47 ` schwab@linux-m68k.org 2024-10-13 17:07 ` cyy at cyyself dot name
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-31317-131-UAFmGgv251@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).