Message ID | 20210719024134.155398-1-siddhesh@sourceware.org |
---|---|
Headers | show |
Series | malloc hooks removal | expand |
This series break old Emacs binaries (e.g. emacs-24.3-23.el7.x86_64): $ bash testrun.sh /usr/bin/emacs Fatal error 11: Segmentation fault Backtrace: /usr/bin/emacs[0x4f8653] /usr/bin/emacs[0x4ddc81] /usr/bin/emacs[0x4f70ee] /usr/bin/emacs[0x4f7273] ./libc.so.6(+0x3cd80)[0x7f88c1a14d80] ./libc.so.6(+0x90c21)[0x7f88c1a68c21] ./libc.so.6(+0x94011)[0x7f88c1a6c011] ./libc.so.6(realloc+0x291)[0x7f88c1a6cea1] /usr/bin/emacs[0x536ef2] /usr/bin/emacs(re_compile_pattern+0x9cc)[0x53074c] /usr/bin/emacs[0x5242c7] /usr/bin/emacs[0x524d69] /usr/bin/emacs[0x526259] /usr/bin/emacs[0x5264bc] /usr/bin/emacs[0x551b87] /usr/bin/emacs[0x586c0b] /usr/bin/emacs[0x55171f] /usr/bin/emacs[0x551a2b] /usr/bin/emacs[0x586c0b] /usr/bin/emacs[0x55171f] /usr/bin/emacs[0x551a2b] /usr/bin/emacs[0x586c0b] /usr/bin/emacs[0x55171f] /usr/bin/emacs[0x551a2b] /usr/bin/emacs[0x551dcf] /usr/bin/emacs[0x51243c] /usr/bin/emacs[0x551b6e] /usr/bin/emacs[0x586c0b] /usr/bin/emacs[0x55171f] /usr/bin/emacs[0x551a2b] /usr/bin/emacs[0x586c0b] /usr/bin/emacs[0x55171f] /usr/bin/emacs[0x551a2b] /usr/bin/emacs[0x586c0b] /usr/bin/emacs[0x551a2b] /usr/bin/emacs[0x586c0b] /usr/bin/emacs[0x550b3d] /usr/bin/emacs[0x550f02] /usr/bin/emacs[0x5544ad] /usr/bin/emacs[0x55002a] /usr/bin/emacs[0x4de186] ... Segmentation fault It is customary to call malloc_set_state from __malloc_initialize_hook. If we no longer call __malloc_initialize_hook, we probably should change malloc_set_state to provide a better error message (via __libc_fatal). Thanks, Florian
On 7/19/21 4:37 PM, Florian Weimer via Libc-alpha wrote: > This series break old Emacs binaries (e.g. emacs-24.3-23.el7.x86_64): > > $ bash testrun.sh /usr/bin/emacs Do they work if you run with LD_PRELOAD=malloc/libc_malloc_debug.so? Siddhesh
* Siddhesh Poyarekar: > On 7/19/21 4:37 PM, Florian Weimer via Libc-alpha wrote: >> This series break old Emacs binaries (e.g. emacs-24.3-23.el7.x86_64): >> $ bash testrun.sh /usr/bin/emacs > > Do they work if you run with LD_PRELOAD=malloc/libc_malloc_debug.so? Basic testing suggests it works. Thanks, Florian
On 7/19/21 4:41 PM, Florian Weimer wrote: > * Siddhesh Poyarekar: > >> On 7/19/21 4:37 PM, Florian Weimer via Libc-alpha wrote: >>> This series break old Emacs binaries (e.g. emacs-24.3-23.el7.x86_64): >>> $ bash testrun.sh /usr/bin/emacs >> >> Do they work if you run with LD_PRELOAD=malloc/libc_malloc_debug.so? > > Basic testing suggests it works. The thing is, set_malloc_state will just not be called without the preload, so it doesn't matter what it returns. What we need to make a more graceful exit is to detect the existence of a non-NULL __malloc_initialize_hook within libc.so and abort. I'm not sure if it's worth the effort. Siddhesh
* Siddhesh Poyarekar: > On 7/19/21 4:41 PM, Florian Weimer wrote: >> * Siddhesh Poyarekar: >> >>> On 7/19/21 4:37 PM, Florian Weimer via Libc-alpha wrote: >>>> This series break old Emacs binaries (e.g. emacs-24.3-23.el7.x86_64): >>>> $ bash testrun.sh /usr/bin/emacs >>> >>> Do they work if you run with LD_PRELOAD=malloc/libc_malloc_debug.so? >> Basic testing suggests it works. > > The thing is, set_malloc_state will just not be called without the > preload, so it doesn't matter what it returns. What we need to make a > more graceful exit is to detect the existence of a non-NULL > __malloc_initialize_hook within libc.so and abort. I'm not sure if > it's worth the effort. We could remove both symbols from libc.so.6. That would result in error that can be found with search engines. Thanks, Florian
On 7/19/21 4:50 PM, Florian Weimer via Libc-alpha wrote: >> The thing is, set_malloc_state will just not be called without the >> preload, so it doesn't matter what it returns. What we need to make a >> more graceful exit is to detect the existence of a non-NULL >> __malloc_initialize_hook within libc.so and abort. I'm not sure if >> it's worth the effort. > > We could remove both symbols from libc.so.6. That would result in error > that can be found with search engines. __malloc_initialize_hook is defined in the executable so we don't control that, but we could remove malloc_set_state (and maybe also malloc_get_state to be consistent?) and keep it only in libc_malloc_debug.so. May I do it on top of this set though? I'd like to avoid respinning this set if I could. Siddhesh