Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 912343 - sys-apps/memtest86-4.3.7-r3 fails to build with >=sys-devel/binutils-2.41[hardened]
Summary: sys-apps/memtest86-4.3.7-r3 fails to build with >=sys-devel/binutils-2.41[har...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: binutils-2.41
  Show dependency tree
 
Reported: 2023-08-16 07:32 UTC by Attila Tóth
Modified: 2023-08-28 19:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Attila Tóth 2023-08-16 07:32:06 UTC
Although sys-apps/memtest86-4.3.7-r3 compiles fine with sys-devel/binutils-2.40, it fails to build with sys-devel/binutils-2.41, due to dynamic relocations and LOAD segment RWX permissions detected during linking.

sys-devel/binutils-2.41:
x86_64-pc-linux-gnu-ld --warn-constructors --warn-common -static -T memtest_shared.lds -m elf_i386 \
-o memtest_shared head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o config.o memsize.o error.o smp.o cpuid.o vmem.o random.o && \
x86_64-pc-linux-gnu-ld -shared -Bsymbolic -T memtest_shared.lds -o memtest_shared head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o config.o memsize.o error.o smp.o cpuid.o vmem.o random.o
x86_64-pc-linux-gnu-ld: reloc.o: warning: relocation in read-only section `.rodata'
x86_64-pc-linux-gnu-ld: warning: memtest_shared has a LOAD segment with RWX permissions
x86_64-pc-linux-gnu-ld: read-only segment has dynamic relocations
make: *** [Makefile:24: memtest_shared] Error 1

sys-devel/binutils-2.40:
x86_64-pc-linux-gnu-ld --warn-constructors --warn-common -static -T memtest_shared.lds -m elf_i386 \
-o memtest_shared head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o config.o memsize.o error.o smp.o cpuid.o vmem.o random.o && \
x86_64-pc-linux-gnu-ld -shared -Bsymbolic -T memtest_shared.lds -o memtest_shared head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o config.o memsize.o error.o smp.o cpuid.o vmem.o random.o
x86_64-pc-linux-gnu-ld: warning: head.o: missing .note.GNU-stack section implies executable stack
x86_64-pc-linux-gnu-ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
x86_64-pc-linux-gnu-ld: warning: head.o: missing .note.GNU-stack section implies executable stack
x86_64-pc-linux-gnu-ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
x86_64-pc-linux-gnu-ld: reloc.o: warning: relocation in read-only section `.rodata'
x86_64-pc-linux-gnu-ld: warning: memtest_shared has a LOAD segment with RWX permissions
x86_64-pc-linux-gnu-ld: warning: creating DT_TEXTREL in a shared object
objcopy -O binary memtest_shared memtest_shared.bin
x86_64-pc-linux-gnu-ld -T memtest.bin.lds bootsect.o setup.o -b binary \
memtest_shared.bin -o memtest.bin
x86_64-pc-linux-gnu-ld -s -T memtest.lds -b binary memtest_shared.bin -o memtest

This bug is a candidate of https://bugs.gentoo.org/911581 tracker bug.

Reproducible: Always
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-08-16 07:36:05 UTC
Thanks. It's because of the hardened changes we made in 2.41.

Can you include the full build.log w/ 2.41 and emerge --info for completeness?
Comment 2 Larry the Git Cow gentoo-dev 2023-08-28 19:32:35 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abce894dde2ad1b4babeaa1f4fc86e76e22e0c45

commit abce894dde2ad1b4babeaa1f4fc86e76e22e0c45
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-08-28 19:14:35 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-08-28 19:32:20 +0000

    sys-apps/memtest86: fix build w/ binutils-2.41[hardened]
    
    Closes: https://bugs.gentoo.org/912343
    Signed-off-by: Sam James <sam@gentoo.org>

 .../memtest86-4.3.7-binutils-2.41-textrels.patch   | 31 ++++++++++++++++++++++
 sys-apps/memtest86/memtest86-4.3.7-r3.ebuild       |  3 ++-
 2 files changed, 33 insertions(+), 1 deletion(-)