glibc 2.36 *.o files debug extraction broken

Jan Palus atler at pld-linux.org
Tue Aug 16 23:01:23 CEST 2022


On 16.08.2022 21:53, Jakub Bogusz wrote:
> On Tue, Aug 16, 2022 at 09:28:58PM +0200, Jan Palus wrote:
> > On 16.08.2022 20:31, Jakub Bogusz wrote:
> > > In glibc 2.36 build debuginfo extraction process removes .note.GNU-stack
> > > section:
> > 
> > ...
> > 
> > > For now only i686 builds are affected because x86_64 and x32 glibc-devel packages
> > > haven't been updated on builders.
> > > 
> > > 
> > > Any guesses what changed?
> > 
> > I believe to be responsible for this, specifically with this debugedit
> > commit:
> > 
> > commit bd392272c04d608257eb999670d85261d5125d93
> > Author: Jan Palus <atler at pld-linux.org>
> > Date:   Tue Jun 7 11:39:01 2022
> > 
> >     bring back patch from rpm 4.16 for no exe bit when searching debuginfo; rel 2
> > 
> > which now considers non-executable object file matching pattern
> > found in `find-debuginfo`: ^\(.*\):[   ]*.*ELF.*, not stripped.*
> > 
> > Which in turn causes object file to be passed to `eu-strip` directly
> > responsible for stripping .note.GNU-stack section.
> > 
> > Fix proposals:
> > 
> > 1. modify `find-debuginfo` pattern to include ELF.*\(executable\|shared object\)
> > 2. modify macros to invoke `find-debuginfo` with `--keep-section .note.GNU-stack`
> > 3. both 1 and 2
> 
> I think it would be safer to revert to not touching *.o files (by
> default).

For the time being implemented 1. not to regress packages initial fix
was done for.

> BTW, why find-debuginfo removes .note.GNU-stack from *.o and doesn't remove
> from *.a/*.so?

To be precise it's eu-strip that find-debuginfo invokes. Regarding
actual question these are two different things:

object files (*.o) hold information for linker in .note.GNU-stack
section of ELF file. Linker uses this information when creating shared
objects (*.so) or executables to construct GNU_STACK program header in
output ELF file. GNU_STACK is in turn used by kernel. eu-strip does not
touch ELF program headers at all so it's plain copy. It only operates on
ELF sections. So that's why executable/so files are not affected. (note
that mentioned archives (*.a) are not considered for debuginfo
extraction).

I see a comment in elfutils strip code that intention was to keep all
ELF notes, which while implemented, does not affect .note.GNU-stack.
Most notes appear to be of type SHT_NOTE (that's what implementation
relies on) however .note.GNU-stack is of type SHT_PROGBITS (ref elf(5)).
I will raise a question to elfutils whether this is intended.


More information about the pld-devel-en mailing list