|
Message-ID: <20200925185834.GN3265@brightrain.aerifal.cx> Date: Fri, 25 Sep 2020 14:58:34 -0400 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Cc: Dominic Chen <d.c.ddcc@...il.com> Subject: Re: SIGSEGV with TEXTREL On Fri, Sep 25, 2020 at 11:37:33AM +0200, Szabolcs Nagy wrote: > * Dominic Chen <d.c.ddcc@...il.com> [2020-09-24 23:50:19 -0400]: > > Please CC me on replies. > > > > I recently discovered that musl doesn't support DT/DF_TEXTREL in the > > main executable, which can result in the dynamic loader crashing with > > SIGSEGV and SEGV_ACCERR while processing relocations. I spent a few days > > trying to fix this in the toolchain, but because it is a prototype based > > on Clang/LLVM 4.0.0 that adds runtime instrumentation built using the > > x64 large code model, so it's not easy to fix. Also, glibc does support > > this behavior. > > there are no existing libcs that fully support textrels > (since for that not just dynamic relocs but static relocs > need to be supported too). > > glibc only supports a small set of textrels and of course > [...] Indeed, textrels are intentionally not supported as part of the philosophy of having a dynamic linker that's universal rather than arch-specific for each arch. Dynamic relocations are pretty much the same on all archs but each arch has its own (often giant) set of possible textrels based on the encoding of addresses in its instruction set. For legacy reasons, a limited number of textrel types are supported, only on some archs (basically just i386 and x86_64), in shared library code. At least at one point, there was still a decent amount of x86 asm that was not PIC-ready, especially in graphics code. I think that time is actually past now, but it doesn't make sense to remove something that didn't need any special support to begin with. On the other hand, there's no compelling reason to support textrels in the main program since the main program can just be linked as non-PIE if you have object files (e.g. due to asm source files or static libraries you don't have source to) that are not PIC-compatible. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.