Skip to content

Conversation

@simpleton
Copy link
Contributor

cherry-pick bpftrace/bpftrace@665b754

A __data_loc field is an (offset, len) pair; its value is determined by
adding the offset (in bytes) to the address of the tracepoint struct.

Commit bpftrace/bpftrace@06a8972 ("codegen: use preserve_static_offset intrinsic")
replaced the add instruction with getelementptr, but used i32 as the
GEP type without adjusting the offset. This causes the value to be
incorrectly set to ctx + 4*offset.

For example, this currently prints an empty or incomplete filename:

bpftrace -e 't:sched:sched_process_exec { print(str(args.filename)) }'

Fix it by changing the getelementptr type argument to i8.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 9, 2025
@simpleton simpleton merged commit 465ad60 into facebookexperimental:main Jun 9, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants