• R
    selftests/bpf: add verifier cgroup storage tests · d4c9f573
    Roman Gushchin 提交于
    Add the following verifier tests to cover the cgroup storage
    functionality:
    1) valid access to the cgroup storage
    2) invalid access: use regular hashmap instead of cgroup storage map
    3) invalid access: use invalid map fd
    4) invalid access: try access memory after the cgroup storage
    5) invalid access: try access memory before the cgroup storage
    6) invalid access: call get_local_storage() with non-zero flags
    
    For tests 2)-6) check returned error strings.
    
    Expected output:
      $ ./test_verifier
      #0/u add+sub+mul OK
      #0/p add+sub+mul OK
      #1/u DIV32 by 0, zero check 1 OK
      ...
      #280/p valid cgroup storage access OK
      #281/p invalid cgroup storage access 1 OK
      #282/p invalid cgroup storage access 2 OK
      #283/p invalid per-cgroup storage access 3 OK
      #284/p invalid cgroup storage access 4 OK
      #285/p invalid cgroup storage access 5 OK
      ...
      #649/p pass modified ctx pointer to helper, 2 OK
      #650/p pass modified ctx pointer to helper, 3 OK
      Summary: 901 PASSED, 0 SKIPPED, 0 FAILED
    Signed-off-by: NRoman Gushchin <guro@fb.com>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: Daniel Borkmann <daniel@iogearbox.net>
    Acked-by: NMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
    d4c9f573
bpf_helpers.h 12.2 KB