bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/32572] New: -z force-bti + -Ttext-segment produce wrong PLT entr


From: aurelien at aurel32 dot net
Subject: [Bug ld/32572] New: -z force-bti + -Ttext-segment produce wrong PLT entries on aarch64
Date: Sun, 19 Jan 2025 11:01:06 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=32572

            Bug ID: 32572
           Summary: -z force-bti + -Ttext-segment produce wrong PLT
                    entries on aarch64
           Product: binutils
           Version: 2.44 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: aurelien at aurel32 dot net
  Target Milestone: ---
              Host: aarch64-unknown-linux-gnu
            Target: aarch64-unknown-linux-gnu
             Build: aarch64-unknown-linux-gnu

The future glibc 2.41 added two new tests, elf/tst-pie-address and
elf/tst-pie-address-static, that fail when enabling PAC/BTI on aarch64. Further
investigation by Adhemerval Zanella Netto [2] shows that ld generate wrong plt
entries when -z force-bti and -Ttext-segment options are used together:

* default options
00000000000012e0 <memcpy@plt>:
    12e0:       f00000f0        adrp    x16, 20000 <memcpy@GLIBC_2.17>
    12e4:       f9400211        ldr     x17, [x16]
    12e8:       91000210        add     x16, x16, #0x0
    12ec:       d61f0220        br      x17

* with -Ttext-segment=0x0000000000400000
00000000004012e0 <memcpy@plt>:
  4012e0:       f00000f0        adrp    x16, 420000 <memcpy@GLIBC_2.17>
  4012e4:       f9400211        ldr     x17, [x16]
  4012e8:       91000210        add     x16, x16, #0x0
  4012ec:       d61f0220        br      x17

* with -z force-bti
0000000000001370 <memcpy@plt>:
    1370:       f00000f0        adrp    x16, 20000 <memcpy@GLIBC_2.17>
    1374:       f9400211        ldr     x17, [x16]
    1378:       91000210        add     x16, x16, #0x0
    137c:       d61f0220        br      x17

* with -z force-bti + -Ttext-segment=0x0000000000400000
0000000000401370 <memcpy@plt>:
  401370:       90000010        adrp    x16, 401000 <_init-0x328>
  401374:       f90000f1        str     x17, [x7]
  401378:       91000210        add     x16, x16, #0x0
  40137c:       d6000220        .inst   0xd6000220 ; undefined
  401380:       90000010        adrp    x16, 401000 <_init-0x328>
  401384:       f90000f1        str     x17, [x7]


[1]
https://sourceware.org/git/?p=glibc.git;a=commit;h=e7b553272196e6175b8a15f807cb59217ba2843a
[2] https://sourceware.org/pipermail/libc-alpha/2025-January/164046.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]