• Andrey Ignatov's avatar
    selftests/bpf: Test indirect var_off stack access in unpriv mode · 2c6927db
    Andrey Ignatov authored
    Test that verifier rejects indirect stack access with variable offset in
    unprivileged mode and accepts same code in privileged mode.
    
    Since pointer arithmetics is prohibited in unprivileged mode verifier
    should reject the program even before it gets to helper call that uses
    variable offset, at the time when that variable offset is trying to be
    constructed.
    
    Example of output:
      # ./test_verifier
      ...
      #859/u indirect variable-offset stack access, priv vs unpriv OK
      #859/p indirect variable-offset stack access, priv vs unpriv OK
    Signed-off-by: default avatarAndrey Ignatov <rdna@fb.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    2c6927db
var_off.c 6.21 KB