Skip to content

fix(bpf): accept sopaths of maximum length - #6132

Open
FedeDP wants to merge 1 commit into
mainfrom
fededp/fix/bpf_sopath_max_len
Open

FedeDP wants to merge 1 commit into
mainfrom
fededp/fix/bpf_sopath_max_len

Conversation

@FedeDP

@FedeDP FedeDP commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Userspace accepts sopaths of up to SOPATH_MAX - 1 (127) characters and stores their length including the NULL terminator, so up to SOPATH_MAX. BPF masked that length with SOPATH_MAX - 1, which turned the maximum length into 0 and reverted the override as "too big".

Check that the length does not exceed SOPATH_MAX instead of masking it.

While at it, also enforce a comp time size for sopath probe_write_user.

Changelog

fix(bpf): accept sopaths of maximum length

Userspace accepts sopaths of up to SOPATH_MAX - 1 (127) characters and
stores their length including the NULL terminator, so up to SOPATH_MAX.
BPF masked that length with SOPATH_MAX - 1, which turned
the maximum length into 0 and reverted the override as "too big".

Check that the length does not exceed SOPATH_MAX instead of masking it.

While at it, also enforce a comp time size for sopath `probe_write_user`.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@FedeDP
FedeDP requested a review from a team as a code owner November 23, 2026 11:47
@FedeDP
FedeDP requested a review from olsajiri November 23, 2026 11:47
@FedeDP FedeDP added kind/bug Something isn't working release-note/bug This PR fixes an issue in a previous release of Tetragon. needs-backport/1.8 labels Nov 23, 2026
@FedeDP FedeDP changed the title fix(bpf): accept sopaths of the maximum length fix(bpf): accept sopaths of maximum length Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working needs-backport/1.8 release-note/bug This PR fixes an issue in a previous release of Tetragon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant