NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/57717: Alpha linker generates LOAD segments (and generates warnings about them)



>Number:         57717
>Category:       toolchain
>Synopsis:       Alpha linker generates LOAD segments (and generates warnings about them)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 21 15:45:01 +0000 2023
>Originator:     Jason Thorpe
>Release:        10.99.10
>Organization:
RISCy Business
>Environment:
NetBSD alpha-vm 10.99.10 NetBSD 10.99.10 (GENERIC-$Revision: 1.418 $) #233: Mon Nov 20 13:56:39 PST 2023  thorpej@the-ripe-vessel:/space/src/sys/arch/alpha/compile/GENERIC.QEMU alpha
>Description:
The Alpha linker is generating an RWX LOAD segment.  It has seeming been doing this for a while, but there is now a warning about it in Binuitls 2.39 (dunno exactly what Binutils version it appeared in, but that's when NetBSD's in-tree toolchain got it - 24-Dec-2022).

On my test vm, I have a test program linked in 2021:

alpha-vm:thorpej 29$ ls -l sigbttest                 
42 -rwxr-xr-x  1 thorpej  users  41176 Nov 20  2021 sigbttest*
alpha-vm:thorpej 30$ file sigbttest                  
sigbttest: ELF 64-bit LSB executable, Alpha (unofficial), version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 9.99.92, not stripped

and as you can see, it has a RWX LOAD segment:

  LOAD           0x0000000000000000 0x0000000120000000 0x0000000120000000
                 0x000000000000813c 0x000000000000813c  R E    0x10000
  LOAD           0x0000000000008140 0x0000000120018140 0x0000000120018140
                 0x000000000000042c 0x0000000000000528  RWE    0x10000


The situation is similar today:

alpha-vm:thorpej 33$ ls -l naughty-physio                                      
16 -rwxr-xr-x  1 thorpej  users  15592 Nov 20 13:42 naughty-physio*
alpha-vm:thorpej 34$ file naughty-physio                                       
naughty-physio: ELF 64-bit LSB executable, Alpha (unofficial), version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 10.99.10, with debug_info, not stripped
alpha-vm:thorpej 35$ 

  LOAD           0x0000000000000000 0x0000000120000000 0x0000000120000000
                 0x0000000000001084 0x0000000000001084  R E    0x10000
  LOAD           0x0000000000001088 0x0000000120011088 0x0000000120011088
                 0x00000000000002e8 0x0000000000000350  RWE    0x10000


...but now the linker emits this warning:

alpha-vm:thorpej 36$ cc -o naughty-physio naughty-physio.c                     
ld: warning: naughty-physio has a LOAD segment with RWX permissions
alpha-vm:thorpej 37$ 


This, in turn, causes some test suite failures:

tp-start: 1700580976.503581, t_nbperf, 7
tc-start: 1700580976.504844, bpz
tc-so:Executing command [ /usr/tests/usr.bin/nbperf/h_nbperf /usr/share/dict/web2 bpz sort -n 4 /usr/tests/usr.bin/nbperf/hash_driver.c ]
tc-se:Fail: stderr not empty
tc-se:--- /dev/null	2023-11-21 15:36:16.962093233 +0000
tc-se:+++ /tmp/check.KoISX8/stderr	2023-11-21 15:36:17.633347163 +0000
tc-se:@@ -0,0 +1 @@
tc-se:+ld: warning: testprog has a LOAD segment with RWX permissions
tc-end: 1700580977.690109, bpz, failed, atf-check failed; see the output of the test for details

>How-To-Repeat:
alpha-vm:thorpej 43$ cat << EOF > hello.c
> #include <stdio.h>
> int main(void) { printf("hellorld!\n"); return 0; }
> EOF
alpha-vm:thorpej 44$ cc -o hello hello.c
ld: warning: hello has a LOAD segment with RWX permissions
alpha-vm:thorpej 45$ ./hello
hellorld!
alpha-vm:thorpej 46$ 

>Fix:
Yes, please!



Home | Main Index | Thread Index | Old Index