Skip to content

increase minimum class region size to avoid OOB access under minimum class region size config#331

Merged
thestinger merged 1 commit into
GrapheneOS:mainfrom
rdevshp:regions_size_oob_fix
May 21, 2026
Merged

increase minimum class region size to avoid OOB access under minimum class region size config#331
thestinger merged 1 commit into
GrapheneOS:mainfrom
rdevshp:regions_size_oob_fix

Conversation

@rdevshp
Copy link
Copy Markdown
Contributor

@rdevshp rdevshp commented May 10, 2026

Under the current configuration limits, when CONFIG_CLASS_REGION_SIZE == 1048576, MAX_REGION_TABLE_SIZE can be smaller than INITIAL_REGION_TABLE_SIZE, which can cause OOB access. This PR proposes a fix for this issue.

@thestinger
Copy link
Copy Markdown
Member

It should be set to a higher value than the initial region table sized to some logical amount.

@rdevshp rdevshp force-pushed the regions_size_oob_fix branch from 8c00080 to 9ce3f61 Compare May 10, 2026 14:43
@rdevshp
Copy link
Copy Markdown
Contributor Author

rdevshp commented May 10, 2026

I've updated the static_assert to require CONFIG_CLASS_REGION_SIZE >= 25165824

@thestinger
Copy link
Copy Markdown
Member

The minimum should probably be a power of 2. It's best if most of these are powers of 2 for higher performance, although it's too much trouble to check for it.

@rdevshp rdevshp force-pushed the regions_size_oob_fix branch from 9ce3f61 to 8b18cf0 Compare May 21, 2026 16:47
@rdevshp
Copy link
Copy Markdown
Contributor Author

rdevshp commented May 21, 2026

I have switched it to require CONFIG_CLASS_REGION_SIZE >= 33554432, which is a power of 2.

@thestinger thestinger merged commit 380ea44 into GrapheneOS:main May 21, 2026
5 checks passed
@rdevshp rdevshp deleted the regions_size_oob_fix branch May 21, 2026 16:53
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