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

Mark the end of IA2 init #296

Merged
merged 4 commits into from
Jan 9, 2024
Merged

Mark the end of IA2 init #296

merged 4 commits into from
Jan 9, 2024

Conversation

fw-immunant
Copy link
Contributor

This lets us avoid errors when running programs with destructors under the memory-map tracking runtime.

I want to factor out the magic constant--where should it live?

@rinon rinon self-requested a review October 2, 2023 20:15
Copy link
Collaborator

@rinon rinon left a comment

Choose a reason for hiding this comment

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

I don't personally mind the duplicated constant as long as you reference the other place it is defined. Alternatively, we could have an internal shared header for this that is included from the runtime? Can we include the whole internal header without picking up any actual code?

/* during init, we allow re-mprotecting memory, which we need to alter
initially-RO destructors */
else if (!memory_map_is_init_finished(map))
return true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't we want to track ownership of things like stacks mappings? If I read this correctly we won't actually mark these regions allocated during init as owned by a particular compartment?

Copy link
Contributor Author

@fw-immunant fw-immunant Jan 9, 2024

Choose a reason for hiding this comment

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

You're right that our memory map doesn't know about stack mappings and other "preexisting" mappings like the vDSO. If we want to fully mirror the kernel's idea of the process' memory map, we would need those, but I'm not 100% sure whether this is a security concern. Specifically, I guess an attack could involve unmapping the original stack and remapping other data in its place, which would then allow corrupting data used during process termination (post-main and dtors). But the original stack is also compartment zero anyway, right?

I'll punt on this for now but will file a bug. (EDIT: filed as #315)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that allowing re-protecting memory during init here is not required because we don't know about stack mappings; these are separate concerns.

runtime/track_memory_map.c Outdated Show resolved Hide resolved
@fw-immunant fw-immunant force-pushed the fw/mark-init-finished branch from 99a0653 to f7548d8 Compare January 9, 2024 23:05
@fw-immunant fw-immunant merged commit 7b0917c into main Jan 9, 2024
33 checks passed
@fw-immunant fw-immunant deleted the fw/mark-init-finished branch May 28, 2024 20:17
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