Skip to content

BUG: fix seccomp_export_bpf_mem out-of-bounds read#458

Closed
alyssais wants to merge 1 commit intoseccomp:mainfrom
alyssais:oob
Closed

BUG: fix seccomp_export_bpf_mem out-of-bounds read#458
alyssais wants to merge 1 commit intoseccomp:mainfrom
alyssais:oob

Conversation

@alyssais
Copy link
Copy Markdown
Contributor

*len is the length of the destination buffer, but program->blks is probably not anywhere near that long. It's already been checked above that BPF_PGM_SIZE(program) is less than or equal to *len, so that's the correct value to use here to avoid either reading or writing too much.

I noticed this because tests/11-basic-basic_errors started failing on musl after e797591 ("all: add seccomp_precompute() functionality").

*len is the length of the destination buffer, but program->blks is
probably not anywhere near that long.  It's already been checked above
that BPF_PGM_SIZE(program) is less than or equal to *len, so that's
the correct value to use here to avoid either reading or writing too
much.

I noticed this because tests/11-basic-basic_errors started failing on
musl after e797591 ("all: add seccomp_precompute() functionality").

Signed-off-by: Alyssa Ross <hi@alyssa.is>
@alyssais alyssais changed the title api: seccomp_export_bpf_mem fix out-of-bounds read api: fix seccomp_export_bpf_mem out-of-bounds read Feb 13, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Feb 14, 2025

Coverage Status

coverage: 90.239%. remained the same
when pulling 904e9de on alyssais:oob
into e8dbc6b on seccomp:main.

Copy link
Copy Markdown
Member

@drakenclimber drakenclimber left a comment

Choose a reason for hiding this comment

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

Acked-by: Tom Hromatka <tom.hromatka@oracle.com>

@pcmoore pcmoore changed the title api: fix seccomp_export_bpf_mem out-of-bounds read BUG: fix seccomp_export_bpf_mem out-of-bounds read Mar 18, 2025
@pcmoore pcmoore added the bug label Mar 18, 2025
@pcmoore pcmoore added this to the v2.6.1 milestone Mar 18, 2025
@pcmoore
Copy link
Copy Markdown
Member

pcmoore commented Mar 18, 2025

Merged into main via e8dbc6b, keeping open until the backport to release-2.6 is complete.

@pcmoore pcmoore closed this Mar 18, 2025
@pcmoore pcmoore reopened this Mar 18, 2025
@pcmoore
Copy link
Copy Markdown
Member

pcmoore commented Mar 18, 2025

Merged into release-2.6 via dd759e8, thank you!

@pcmoore pcmoore closed this Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants