Skip to content
  • Alexei Starovoitov's avatar
    bpf: add unprivileged bpf tests · bf508877
    Alexei Starovoitov authored
    Add new tests samples/bpf/test_verifier:
    
    unpriv: return pointer
      checks that pointer cannot be returned from the eBPF program
    
    unpriv: add const to pointer
    unpriv: add pointer to pointer
    unpriv: neg pointer
      checks that pointer arithmetic is disallowed
    
    unpriv: cmp pointer with const
    unpriv: cmp pointer with pointer
      checks that comparison of pointers is disallowed
      Only one case allowed 'void *value = bpf_map_lookup_elem(..); if (value == 0) ...'
    
    unpriv: check that printk is disallowed
      since bpf_trace_printk is not available to unprivileged
    
    unpriv: pass pointer to helper function
      checks that pointers cannot be passed to functions that expect integers
      If function expects a pointer the verifier allows only that type of pointer.
      Like 1st argument of bpf_map_lookup_elem() must be pointer to map.
      (applies to non-root as well)
    
    unpriv: indirectly pass pointer on stack to helper function
      checks that pointer stored into stack cannot be used as part of key
      pass...
    bf508877