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

Compilation broken on Ubuntu 20.04 #102

Closed
MatteoNardi opened this issue Oct 26, 2022 · 1 comment
Closed

Compilation broken on Ubuntu 20.04 #102

MatteoNardi opened this issue Oct 26, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@MatteoNardi
Copy link
Contributor

This happens only when using clang version <= 12
This is a regression caused by the argument extraction code:

https://github.com/Exein-io/pulsar/blob/99444dd952bfd1dc92af135fc92400ea6c8f92a2/modules/process-monitor/probes.bpf.c#L142-L143

The verifier complains length might be negative:

           ; event->exec.data_len = len;
           104: (63) *(u32 *)(r8 +276) = r7
            R0=inv(id=0) R1=inv(id=0,umax_value=255,var_off=(0x0; 0xff)) R2=inv256 R4=inv(id=8) R6=inv(id=0) R7=inv(id=8) R8=map_value(id=0,off=0,ks=4,vs=536,imm=0) R9=map_value(id=0,off=0,ks=4,vs=536,imm=0) R10=fp0 fp-112=mmmmmmmm fp-120=inv fp-128=ctx fp-136=mmmmmmmm
           105: R0=inv(id=0) R1=inv(id=0,umax_value=255,var_off=(0x0; 0xff)) R2=inv256 R4=inv(id=8) R6=inv(id=0) R7=inv(id=8) R8=map_value(id=0,off=0,ks=4,vs=536,imm=0) R9=map_value(id=0,off=0,ks=4,vs=536,imm=0) R10=fp0 fp-112=mmmmmmmm fp-120=inv fp-128=ctx fp-136=mmmmmmmm
           ; bpf_core_read_user(event->exec.argv, len & (NAME_MAX - 1), (void *)start);
           105: (07) r9 += 280
           106: R0=inv(id=0) R1=inv(id=0,umax_value=255,var_off=(0x0; 0xff)) R2=inv256 R4=inv(id=8) R6=inv(id=0) R7=inv(id=8) R8=map_value(id=0,off=0,ks=4,vs=536,imm=0) R9_w=map_value(id=0,off=280,ks=4,vs=536,imm=0) R10=fp0 fp-112=mmmmmmmm fp-120=inv fp-128=ctx fp-136=mmmmmmmm
           106: (bf) r1 = r9
           107: R0=inv(id=0) R1_w=map_value(id=0,off=280,ks=4,vs=536,imm=0) R2=inv256 R4=inv(id=8) R6=inv(id=0) R7=inv(id=8) R8=map_value(id=0,off=0,ks=4,vs=536,imm=0) R9_w=map_value(id=0,off=280,ks=4,vs=536,imm=0) R10=fp0 fp-112=mmmmmmmm fp-120=inv fp-128=ctx fp-136=mmmmmmmm
           107: (bf) r2 = r7
           108: R0=inv(id=0) R1_w=map_value(id=0,off=280,ks=4,vs=536,imm=0) R2_w=inv(id=8) R4=inv(id=8) R6=inv(id=0) R7=inv(id=8) R8=map_value(id=0,off=0,ks=4,vs=536,imm=0) R9_w=map_value(id=0,off=280,ks=4,vs=536,imm=0) R10=fp0 fp-112=mmmmmmmm fp-120=inv fp-128=ctx fp-136=mmmmmmmm
           108: (bf) r3 = r6
           109: R0=inv(id=0) R1_w=map_value(id=0,off=280,ks=4,vs=536,imm=0) R2_w=inv(id=8) R3_w=inv(id=18) R4=inv(id=8) R6=inv(id=18) R7=inv(id=8) R8=map_value(id=0,off=0,ks=4,vs=536,imm=0) R9_w=map_value(id=0,off=280,ks=4,vs=536,imm=0) R10=fp0 fp-112=mmmmmmmm fp-120=inv fp-128=ctx fp-136=mmmmmmmm
           109: (85) call bpf_probe_read_user#112
           R2 min value is negative, either use unsigned or 'var &= const'
           verification time 1779 usec
           stack depth 136
           processed 290 insns (limit 1000000) max_states_per_insn 1 total_states 23 peak_states 23 mark_read 9
           
        1: Permission denied (os error 13)

As a work-around, upgrade llvm:

apt update && apt install -y lsb-release wget software-properties-common gnupg
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 15
ln -s /usr/bin/clang-15 /usr/bin/clang
ln -s /usr/bin/llvm-strip-15 /usr/bin/llvm-strip
@MatteoNardi
Copy link
Contributor Author

Closing as LLVM/clang 12 is not supported. Containers can be used with cross on distributions lacking the required LLVM version.

@MatteoNardi MatteoNardi closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

1 participant