[PATCH v6 0/9] Add support for memory sealing
Yury Khrustalev
yury.khrustalev@arm.com
Fri Mar 21 09:53:51 GMT 2025
On Tue, Mar 18, 2025 at 05:16:48PM +0000, Yury Khrustalev wrote:
> Hi Adhemerval,
>
> On Tue, Mar 11, 2025 at 02:09:47PM -0300, Adhemerval Zanella wrote:
> > The Linux 6.10 (8be7258aad44) added the mseal syscall that allows
> > blocking some memory mapping operations on the VMA range:
> >
>
> At least 4 tests fail due to BTI detecting mismatch when the binaries for these tests
> are built with `-Wl,-z,memory-seal`:
>
> FAIL: elf/filter
I'm using GCC toolchain built with `--enable-standard-branch-protection`
with binutils 2.44.
The tests fail with SIGILL due to not having proper BTI landing pad in
the PLT sequence of test library `elf/filtmod1.so`. When this library is
linked with `-Wl,-z,memory-seal`, for some reason generated PLT sequence
looks like this:
```
00000000000004e0 <.plt>:
4e0: a9bf7bf0 stp x16, x30, [sp, #-16]!
4e4: f00000f0 adrp x16, 1f000 <__FRAME_END__+0x1e8bc>
4e8: f947fe11 ldr x17, [x16, #4088]
4ec: 913fe210 add x16, x16, #0xff8
4f0: d61f0220 br x17
```
And it should start with
```
00000000000004f0 <.plt>:
4f0: d503245f bti c
...
```
The latter does work when linking with `-Wl,-z,nomemory-seal`.
Another test library `elf/filtmod2.so` has correct PLT sequence but only
becuase BTI is requested explicitly on the command line for it with the
`-Wl,-z,force-bti` option.
I suspect something is wrong with the static linker when it processes
objects with BTI and is supposed to generate correct PLT sequece with
BTI landing pad by default.
Kind regards,
Yury
More information about the Libc-alpha
mailing list