Skip to content

Harden untrusted input remoteproc pt2 - #704

Merged
arnopo merged 2 commits into
OpenAMP:mainfrom
bentheredonethat:Harden-untrusted-input-remoteproc-pt2
Oct 19, 2026
Merged

arnopo merged 2 commits into
OpenAMP:mainfrom
bentheredonethat:Harden-untrusted-input-remoteproc-pt2

Conversation

@bentheredonethat

Copy link
Copy Markdown
Contributor

note first 4 commits are acked on prev PR #703 top commit is new

@arnopo arnopo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same remark concerning AI verbosity but code LGTM

@bentheredonethat
bentheredonethat force-pushed the Harden-untrusted-input-remoteproc-pt2 branch from 358c7fe to c622bc0 Compare September 21, 2026 14:20
@arnopo

arnopo commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

@bentheredonethat please rebase to resolve conflict

The vring alignment comes from the resource table, which the peer core
can write. The existing checks only reject a zero alignment, so any
other value is stored and forwarded. vring_init() rounds the used ring
address with a ~(align - 1) mask, which clears only low order bits when
the alignment is a power of two. A value such as 0x80000001 makes the
mask clear high order bits of the address instead, placing the used
ring outside the vring memory.

Require a power of two alignment before computing the vring size and
before storing the vring metadata. Check the alignment in the virtqueue
constructor as well, where it sizes the region cleared for the driver
role.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Assisted-by: Codex:GPT-5
The peer resource table can supply a power of two alignment such as
0x80000000. This passes alignment validation but cannot be represented
by the signed int used in vring_size(). Converting the truncated result
to size_t can request an enormous mapping before metadata validation.

Calculate the size with bounded size_t arithmetic and reject descriptor
counts, rounding expressions and final sizes that vring_size() cannot
represent. Apply the check before mapping, storing vring metadata and
clearing the driver ring memory.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Assisted-by: Codex:GPT-6
@bentheredonethat
bentheredonethat force-pushed the Harden-untrusted-input-remoteproc-pt2 branch from 3bde3a1 to e389bf7 Compare October 5, 2026 22:24
@arnopo arnopo added this to the Release V2026.10 milestone Oct 6, 2026
@arnopo
arnopo merged commit e798478 into OpenAMP:main Oct 19, 2026
5 checks passed
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