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

Fix ELF segment end computation #422

Merged
merged 2 commits into from
Oct 5, 2024

Conversation

rinon
Copy link
Collaborator

@rinon rinon commented Oct 4, 2024

ELF segment end computation was using the page-aligned start, not the virtual address start (which may not be page-aligned). This was resulting in not protecting the BSS section.

ELF segment end computation was using the page-aligned start, not the virtual address start (which may not be page-aligned). This was resulting in not protecting the BSS section.
@rinon rinon requested review from ayrtonm and fw-immunant October 4, 2024 22:41
@rinon rinon changed the title Sjc/fix_three_keys_minimal Fix ELF segment end computation Oct 4, 2024
@ayrtonm
Copy link
Contributor

ayrtonm commented Oct 4, 2024

wait do we need an analogous fix for protect_tls_pages? https://github.com/immunant/IA2-Phase2/blob/main/runtime/libia2/ia2.c#L268

@ayrtonm
Copy link
Contributor

ayrtonm commented Oct 4, 2024

I don't remember off-hand how TLS is laid out in memory so I'm not sure. That might be a good thing to document and maybe point out the pkey_mprotected parts in permissive mode logs (#421).

@rinon
Copy link
Collaborator Author

rinon commented Oct 4, 2024

TLS looks ok to me, but RELRO needed the same fix. Not that it matters there because RELRO start is page-aligned already in the ELF, but this just ensures we do it right even if it's not.

@rinon
Copy link
Collaborator Author

rinon commented Oct 4, 2024

maybe point out the pkey_mprotected parts in permissive mode logs (#421).

I don't really understand, what do you want documented?

@ayrtonm
Copy link
Contributor

ayrtonm commented Oct 4, 2024

Oh I meant mark the segments or parts of a segment that are protected in the /proc/pid/maps that we write to the end of each permissive mode log. But I can do it.

@rinon rinon merged commit 4ed050c into sjc/fix_heap_two_keys Oct 5, 2024
34 checks passed
@rinon
Copy link
Collaborator Author

rinon commented Oct 5, 2024

Oops, wrong branch. I'll just push these two commits to main as well.

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

Successfully merging this pull request may close these issues.

2 participants