yonghong-song wrote:

I just updated a patch to change TrivialAutoVarInitMaxSize to 8 if 
TrivialAutoVarInit is set to Zero by clang bpf target. This should mostly solve 
the issue for xdp programs.

@eddyz87 suggested to improve middle-end compilation to issue proper warnings. 
This is what I initially wanted to do as well but feel it would be quite 
complicated esp. related to cross-functions. I am not sure how cross-file 
checking can be done for bpf programs since effectively, we do not do IR-level 
merge across files.

One thing I tried earlier is to do -fsanitize=undefined for bpf programs (see 
discourse discussion link in the description). There will be a 'undef' IR asm 
code to specify as undefined behavior at particular place. Current bpf backend 
maps 'undef' to a no-op.
What we could do is that bpf backend could map 'undef' to a BPF 'trap' insn. 
Later, if verifier hits a 'trap' insn, verification should fail. In case 
verifier won't be able to pass due to 'trap' insn even if the prog is legal, 
'trap' insn can only be issued if -fsanitize=undefined is specified by user. 
WDYT?

https://github.com/llvm/llvm-project/pull/125601
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to