Skip to content
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 1 commit into from
Feb 3, 2023

Commits on Jan 29, 2023

  1. tools/ttysnoop: Fix uninitialized 'buf' error

    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 committed Jan 29, 2023
    Configuration menu
    Copy the full SHA
    af3480a View commit details
    Browse the repository at this point in the history