Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected struct initialiser in RELRO section #673

Open
kevin-brodsky-arm opened this issue Jan 9, 2023 · 0 comments
Open

Unexpected struct initialiser in RELRO section #673

kevin-brodsky-arm opened this issue Jan 9, 2023 · 0 comments

Comments

@kevin-brodsky-arm
Copy link

It seems that Clang will always put a struct initialiser in .data.rel.ro if the struct contains capabilities, even though they are zero-initialised. Reduced case from the Linux kernel: https://cheri-compiler-explorer.cl.cam.ac.uk/z/Pnn9fE. This seems to be target-independent, the same occurs with Morello Clang.

While this is simply unnecessary for standard dynamic binaries, for the Linux kernel this is a more serious issue as no RELRO section is expected (and the linker script asserts that there is none).

stephensmalley pushed a commit to stephensmalley/selinux-kernel that referenced this issue May 30, 2024
CHERI/Morello Clang needlessly places data in the RELRO section in
the presence of capabilities. No such section is expected in linker
scripts, causing issues at link-time and/or runtime.

While waiting for Clang to become more conservative about its use of
RELRO data, work around the issue by placing .data.rel.ro together
with .rodata, which is appropriate for the kernel.

CHERI-LLVM issue: CTSRD-CHERI/llvm-project#673

Signed-off-by: Kevin Brodsky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant