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

linux: make use of mseal(2) #242

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

cgzones
Copy link
Contributor

@cgzones cgzones commented Jul 24, 2024

Instead of protecting the global read-only data structure after startup via the read-only flag, which can be reverted, use the in Linux 6.10 introduced irreversible syscall mseal(2).

memory.c Outdated
return false;
if (unlikely(errno == ENOMEM))
return true;
if (likely(errno == ENOSYS))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be marked likely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped.

Also marked the function COLD, since it is only called from init_slow_path() also tagged COLD.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mseal(2) can return -EPERM on 32-bit architectures, should this be checked explicitly or is 32-bit not supported at all?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32-bit isn't supported.

Instead of protecting the global read-only data structure after startup
via the read-only flag, which can be reverted, use the in Linux 6.10
introduced irreversible syscall mseal(2).
@SkewedZeppelin
Copy link

I've been running this for about a week now without issue.

@thestinger
Copy link
Member

Will get to this eventually, it's just very low priority due to low impact.

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.

3 participants