-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tools/ttysnoop: Fix uninitialized 'buf' error #4453
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV: LLVM 13.0.1, Kernel 5.15.67, aarch64 Overview of the error: The verifier is unhappy, if '(r10 -32)' is not initialized, see also [0]. $ sudo ./ttysnoop.py 10 bpf: Failed to load program: Permission denied 3: (7b) *(u64 *)(r10 -8) = r6 4: (7b) *(u64 *)(r10 -16) = r6 5: (7b) *(u64 *)(r10 -24) = r6 6: (bf) r1 = r10 ... 91: (67) r0 <<= 32 92: (77) r0 >>= 32 ; if (bpf_probe_read_user(&data->buf, BUFSIZE, (void *)buf)) 93: (55) if r0 != 0x0 goto pc+356 R0_w=inv0 R6=invP0 R7=map_value(id=0,off=0,ks=4,vs=260,imm=0) R8=map_value( id=0,off=4,ks=4,vs=260,imm=0) R9=inv256 R10=fp0 fp-8=mmmmmmmm fp-16=mmmmmmmm fp-24=mmmmmmmm 94: (79) r2 = *(u64 *)(r10 -32) invalid read from stack R10 off=-32 size=8 processed 593 insns (limit 1000000) max_states_per_insn 1 total_states 48 peak_states 48 mark_read 3 This issue can also be resolved by upgrading LLVM>=14 and recompile and install bcc. [0] iovisor#2623 Signed-off-by: Rong Tao <[email protected]>
Rtoax
requested review from
brendangregg,
goldshtn and
davemarchevsky
as code owners
January 29, 2023 07:39
Thanks for the fix. LGTM. |
Rtoax
added a commit
to Rtoax/bcc
that referenced
this pull request
Feb 10, 2023
The verifier is unhappy, if data struct _pad_ is not initialized, see [0][1]. $ sudo ./nfsslower.py ... ; bpf_perf_event_output(ctx, (void *)bpf_pseudo_fd(1, -2), CUR_CPU_IDENTIFIER, &data, sizeof(data)); 83: (79) r1 = *(u64 *)(r10 -144) ; R1_w=ctx(off=0,imm=0) R10=fp0 84: (18) r3 = 0xffffffff ; R3_w=4294967295 86: (b7) r5 = 96 ; R5_w=96 87: (85) call bpf_perf_event_output#25 invalid indirect read from stack R4 off -136+92 size 96 processed 84 insns (limit 1000000) max_states_per_insn 0 total_states 4 peak_states 4 mark_read 4 ... raise Exception("Failed to load BPF program %s: %s" % Exception: Failed to load BPF program b'raw_tracepoint__nfs_commit_done': Permission denied [0] iovisor#2623 [1] iovisor#4453 Signed-off-by: Rong Tao <[email protected]>
chenhengqi
pushed a commit
that referenced
this pull request
Feb 11, 2023
The verifier is unhappy, if data struct _pad_ is not initialized, see [0][1]. $ sudo ./nfsslower.py ... ; bpf_perf_event_output(ctx, (void *)bpf_pseudo_fd(1, -2), CUR_CPU_IDENTIFIER, &data, sizeof(data)); 83: (79) r1 = *(u64 *)(r10 -144) ; R1_w=ctx(off=0,imm=0) R10=fp0 84: (18) r3 = 0xffffffff ; R3_w=4294967295 86: (b7) r5 = 96 ; R5_w=96 87: (85) call bpf_perf_event_output#25 invalid indirect read from stack R4 off -136+92 size 96 processed 84 insns (limit 1000000) max_states_per_insn 0 total_states 4 peak_states 4 mark_read 4 ... raise Exception("Failed to load BPF program %s: %s" % Exception: Failed to load BPF program b'raw_tracepoint__nfs_commit_done': Permission denied [0] #2623 [1] #4453 Signed-off-by: Rong Tao <[email protected]>
captain5050
pushed a commit
to captain5050/bcc
that referenced
this pull request
Oct 12, 2023
The verifier is unhappy, if data struct _pad_ is not initialized, see [0][1]. $ sudo ./nfsslower.py ... ; bpf_perf_event_output(ctx, (void *)bpf_pseudo_fd(1, -2), CUR_CPU_IDENTIFIER, &data, sizeof(data)); 83: (79) r1 = *(u64 *)(r10 -144) ; R1_w=ctx(off=0,imm=0) R10=fp0 84: (18) r3 = 0xffffffff ; R3_w=4294967295 86: (b7) r5 = 96 ; R5_w=96 87: (85) call bpf_perf_event_output#25 invalid indirect read from stack R4 off -136+92 size 96 processed 84 insns (limit 1000000) max_states_per_insn 0 total_states 4 peak_states 4 mark_read 4 ... raise Exception("Failed to load BPF program %s: %s" % Exception: Failed to load BPF program b'raw_tracepoint__nfs_commit_done': Permission denied [0] iovisor#2623 [1] iovisor#4453 Signed-off-by: Rong Tao <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ENV: LLVM 13.0.1, Kernel 5.15.67, aarch64
Overview of the error:
The verifier is unhappy, if '(r10 -32)' is not initialized, see also [0].
This issue can also be resolved by upgrading LLVM>=14 and recompile and install bcc.
[0] #2623
Detail: