Skip to content

Conversation

@bdash
Copy link
Contributor

@bdash bdash commented Oct 23, 2025

XNU maps kernel cache segments in with different permissions than the load commands indicate. For instance, __DATA_CONST is initially mapped as read-write before later being re-mapped as read-only. Treating it as read-only results in analysis falsely assuming that global variables cannot change.

To work around this we maintain a mapping from segment name to initial permissions (i.e., most lax permissions) and favor them over permissions derived from the segment load command. Section semantics are also derived from the segment's permissions when the segment is present in the mapping.

The mapping is based on the initial permissions established by arm_vm_prot_init within the XNU source.

Related to #6718.

… them

XNU maps kernel cache segments in with different permissions than the
load commands indicate. For instance, `__DATA_CONST` is initially mapped
as read-write before later being re-mapped as read-only. Treating it as
read-only results in analysis falsely assuming that global variables
cannot change.

To work around this we maintain a mapping from segment name to initial
permissions (i.e., most lax permissions) and favor them over permissions
derived from the segment load command. Section semantics are also
derived from the segment's permissions when the segment is present in
the mapping.

The mapping is based on the initial permissions established by
`arm_vm_prot_init` within the XNU source.
@bdash bdash force-pushed the test_kc_segment_perms branch from cb6e021 to 9a8faad Compare October 23, 2025 20:34
@bdash bdash merged commit 9a8faad into dev Oct 23, 2025
5 checks passed
@bdash bdash deleted the test_kc_segment_perms branch October 23, 2025 20:40
@emesare emesare added this to the Io milestone Nov 11, 2025
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