[PATCH] Linux/x86: Enable --rosegment by default
Michael Matz
matz@suse.de
Wed Mar 18 15:01:00 GMT 2026
Hello,
On Wed, 18 Mar 2026, hev wrote:
> This patch looks acceptable to me, and it’s good to see progress here.
> That said, in some cases, -z noseparate-code can be more helpful for
> THP. I explained the reasoning in another thread. [1][2]
>
> Also, I’m a bit curious: GNU ld with --rosegment doesn’t seem to
> arrange segments as R, RE, RW. From a security perspective, it would
> make more sense to put R first so the ELF header is not executable.
I we'd continue to care for gadget avoidance, which Florian tells us is
not a thing anymore (yippie! :) ).
> LLVM lld with --rosegment does this by default (R, RE, RW).
But your point in these mails is to align the E part to huge-page borders.
Putting a read-only blob in front of it defeats that purpose.
> I wonder whether relying on the current GNU ld --rosegment layout is
> entirely stable, if it ever shifts towards a more security-driven
> layout, it might not behave the way we expect here.
Hmm? Your proposal even was to completely merge the read-only and exec
segment into one. You cannot at the same time care and not care about the
security implications of merging readonly data and code :)
Ciao,
Michael.
More information about the Binutils
mailing list