[cfe-users] BPF stack limit

Steven Simpson via cfe-users cfe-users at lists.llvm.org
Wed Mar 22 09:10:26 PDT 2017


Hi,

I'm using Clang to compile C to eBPF, not to run in the Linux kernel, 
but in ubpf.

I occasionally encounter the error "Looks like the BPF stack limit of 
512 bytes is exceeded".  The limit seems to be hard-wired 
(llvm/lib/Target/BPF/BPFRegisterInfo.cpp):

   if (Offset <= -512) {

(I'm using "clang version 5.0.0 (trunk 294090)" built from SVN source.  
Checked it's still there in r298510.)

Is this an intrinsic limit of eBPF, or just one set by the kernel? If 
the latter, and since the kernel isn't the only place BPF could run, 
could an option be added to override it?  (For the moment, I've just 
disabled the check and rebuilt.  Plus there are still some changes to 
try with my code which might avoid the limit.)

Thanks,

Steven



More information about the cfe-users mailing list