Skip to content

vregion: allocate the metadata separately#10811

Open
lyakh wants to merge 1 commit into
thesofproject:mainfrom
lyakh:vregion
Open

vregion: allocate the metadata separately#10811
lyakh wants to merge 1 commit into
thesofproject:mainfrom
lyakh:vregion

Conversation

@lyakh
Copy link
Copy Markdown
Collaborator

@lyakh lyakh commented May 26, 2026

Allocating vregion metadata together with the actual memory buffer makes that metadata accessible and writable by userspace modules. Fix this by allocating the metadata separately.

Copilot AI review requested due to automatic review settings May 26, 2026 13:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a security/design issue in the Zephyr vregion allocator where the struct vregion metadata was previously stored inside the same virtual-memory buffer that can be mapped/writable by userspace modules; it now allocates the metadata separately to prevent userspace from modifying allocator internals.

Changes:

  • Stop embedding struct vregion inside the vpage-allocated region; allocate it separately via rmalloc().
  • Adjust lifetime partition initialization to no longer skip over the embedded metadata.
  • Ensure vregion_put() frees both the vpage region and the separately allocated metadata.

Comment thread zephyr/lib/vregion.c Outdated
Comment thread zephyr/lib/vregion.c
Comment thread zephyr/lib/vregion.c
Allocating vregion metadata together with the actual memory buffer
makes that metadata accessible and writable by userspace modules. Fix
this by allocating the metadata separately.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
@lgirdwood
Copy link
Copy Markdown
Member

@lyakh can you check internal CI. Thanks

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