forked from Minki/linux
selftest/bpf: Adjust expected verifier errors
The verifier errors around stack accesses have changed slightly in the previous commit (generally for the better). Signed-off-by: Andrei Matei <andreimatei1@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20210207011027.676572-3-andreimatei1@gmail.com
This commit is contained in:
parent
01f810ace9
commit
a680cb3d8e
@ -4,7 +4,7 @@
|
||||
BPF_ST_MEM(BPF_DW, BPF_REG_10, 8, 0),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr = "invalid stack",
|
||||
.errstr = "invalid write to stack",
|
||||
.result = REJECT,
|
||||
},
|
||||
{
|
||||
|
@ -1228,7 +1228,7 @@
|
||||
.prog_type = BPF_PROG_TYPE_XDP,
|
||||
.fixup_map_hash_8b = { 23 },
|
||||
.result = REJECT,
|
||||
.errstr = "invalid read from stack off -16+0 size 8",
|
||||
.errstr = "invalid read from stack R7 off=-16 size=8",
|
||||
},
|
||||
{
|
||||
"calls: two calls that receive map_value via arg=ptr_stack_of_caller. test1",
|
||||
@ -1958,7 +1958,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.fixup_map_hash_48b = { 6 },
|
||||
.errstr = "invalid indirect read from stack off -8+0 size 8",
|
||||
.errstr = "invalid indirect read from stack R2 off -8+0 size 8",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_XDP,
|
||||
},
|
||||
|
@ -23,7 +23,7 @@
|
||||
BPF_EMIT_CALL(BPF_FUNC_probe_read_kernel),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr = "invalid stack type R1 off=-48 access_size=58",
|
||||
.errstr = "invalid indirect access to stack R1 off=-48 size=58",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_TRACEPOINT,
|
||||
},
|
||||
@ -54,7 +54,7 @@
|
||||
BPF_EMIT_CALL(BPF_FUNC_probe_read_kernel),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr = "invalid stack type R1 off=-48 access_size=58",
|
||||
.errstr = "invalid indirect access to stack R1 off=-48 size=58",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_TRACEPOINT,
|
||||
},
|
||||
|
@ -39,7 +39,7 @@
|
||||
BPF_EMIT_CALL(BPF_FUNC_probe_read_kernel),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr = "invalid indirect read from stack off -64+0 size 64",
|
||||
.errstr = "invalid indirect read from stack R1 off -64+0 size 64",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_TRACEPOINT,
|
||||
},
|
||||
@ -59,7 +59,7 @@
|
||||
BPF_MOV64_IMM(BPF_REG_0, 0),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr = "invalid stack type R1 off=-64 access_size=65",
|
||||
.errstr = "invalid indirect access to stack R1 off=-64 size=65",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_TRACEPOINT,
|
||||
},
|
||||
@ -136,7 +136,7 @@
|
||||
BPF_MOV64_IMM(BPF_REG_0, 0),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr = "invalid stack type R1 off=-64 access_size=65",
|
||||
.errstr = "invalid indirect access to stack R1 off=-64 size=65",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_TRACEPOINT,
|
||||
},
|
||||
@ -156,7 +156,7 @@
|
||||
BPF_MOV64_IMM(BPF_REG_0, 0),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr = "invalid stack type R1 off=-64 access_size=65",
|
||||
.errstr = "invalid indirect access to stack R1 off=-64 size=65",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_TRACEPOINT,
|
||||
},
|
||||
@ -194,7 +194,7 @@
|
||||
BPF_MOV64_IMM(BPF_REG_0, 0),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr = "invalid indirect read from stack off -64+0 size 64",
|
||||
.errstr = "invalid indirect read from stack R1 off -64+0 size 64",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_TRACEPOINT,
|
||||
},
|
||||
@ -584,7 +584,7 @@
|
||||
BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr = "invalid indirect read from stack off -64+32 size 64",
|
||||
.errstr = "invalid indirect read from stack R1 off -64+32 size 64",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_TRACEPOINT,
|
||||
},
|
||||
|
@ -27,7 +27,7 @@
|
||||
},
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_CGROUP_SYSCTL,
|
||||
.errstr = "invalid indirect read from stack off -16+0 size 8",
|
||||
.errstr = "invalid indirect read from stack R4 off -16+0 size 8",
|
||||
},
|
||||
{
|
||||
"ARG_PTR_TO_LONG half-uninitialized",
|
||||
@ -59,7 +59,7 @@
|
||||
},
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_CGROUP_SYSCTL,
|
||||
.errstr = "invalid indirect read from stack off -16+4 size 8",
|
||||
.errstr = "invalid indirect read from stack R4 off -16+4 size 8",
|
||||
},
|
||||
{
|
||||
"ARG_PTR_TO_LONG misaligned",
|
||||
@ -125,7 +125,7 @@
|
||||
},
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_CGROUP_SYSCTL,
|
||||
.errstr = "invalid stack type R4 off=-4 access_size=8",
|
||||
.errstr = "invalid indirect access to stack R4 off=-4 size=8",
|
||||
},
|
||||
{
|
||||
"ARG_PTR_TO_LONG initialized",
|
||||
|
@ -11,7 +11,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = REJECT,
|
||||
.errstr = "invalid read from stack off -8+0 size 8",
|
||||
.errstr = "invalid read from stack R6 off=-8 size=8",
|
||||
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
|
||||
},
|
||||
{
|
||||
@ -59,7 +59,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = REJECT,
|
||||
.errstr = "invalid stack type R3",
|
||||
.errstr = "invalid zero-sized read",
|
||||
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
|
||||
},
|
||||
{
|
||||
@ -205,7 +205,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = REJECT,
|
||||
.errstr = "invalid stack type R3 off=-513 access_size=8",
|
||||
.errstr = "invalid indirect access to stack R3 off=-513 size=8",
|
||||
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
|
||||
},
|
||||
{
|
||||
@ -221,7 +221,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = REJECT,
|
||||
.errstr = "invalid stack type R3 off=-1 access_size=8",
|
||||
.errstr = "invalid indirect access to stack R3 off=-1 size=8",
|
||||
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
|
||||
},
|
||||
{
|
||||
@ -285,7 +285,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = REJECT,
|
||||
.errstr = "invalid stack type R3 off=-512 access_size=0",
|
||||
.errstr = "invalid zero-sized read",
|
||||
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
|
||||
},
|
||||
{
|
||||
|
@ -44,7 +44,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = REJECT,
|
||||
.errstr = "invalid stack off=-79992 size=8",
|
||||
.errstr = "invalid write to stack R1 off=-79992 size=8",
|
||||
.errstr_unpriv = "R1 stack pointer arithmetic goes out of range",
|
||||
},
|
||||
{
|
||||
@ -57,7 +57,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = REJECT,
|
||||
.errstr = "invalid stack off=0 size=8",
|
||||
.errstr = "invalid write to stack R1 off=0 size=8",
|
||||
},
|
||||
{
|
||||
"PTR_TO_STACK check high 1",
|
||||
@ -106,7 +106,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr_unpriv = "R1 stack pointer arithmetic goes out of range",
|
||||
.errstr = "invalid stack off=0 size=1",
|
||||
.errstr = "invalid write to stack R1 off=0 size=1",
|
||||
.result = REJECT,
|
||||
},
|
||||
{
|
||||
@ -119,7 +119,8 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = REJECT,
|
||||
.errstr = "invalid stack off",
|
||||
.errstr_unpriv = "R1 stack pointer arithmetic goes out of range",
|
||||
.errstr = "invalid write to stack R1",
|
||||
},
|
||||
{
|
||||
"PTR_TO_STACK check high 6",
|
||||
@ -131,7 +132,8 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = REJECT,
|
||||
.errstr = "invalid stack off",
|
||||
.errstr_unpriv = "R1 stack pointer arithmetic goes out of range",
|
||||
.errstr = "invalid write to stack",
|
||||
},
|
||||
{
|
||||
"PTR_TO_STACK check high 7",
|
||||
@ -183,7 +185,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr_unpriv = "R1 stack pointer arithmetic goes out of range",
|
||||
.errstr = "invalid stack off=-513 size=1",
|
||||
.errstr = "invalid write to stack R1 off=-513 size=1",
|
||||
.result = REJECT,
|
||||
},
|
||||
{
|
||||
@ -208,7 +210,8 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = REJECT,
|
||||
.errstr = "invalid stack off",
|
||||
.errstr_unpriv = "R1 stack pointer arithmetic goes out of range",
|
||||
.errstr = "invalid write to stack",
|
||||
},
|
||||
{
|
||||
"PTR_TO_STACK check low 6",
|
||||
@ -220,7 +223,8 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result = REJECT,
|
||||
.errstr = "invalid stack off",
|
||||
.errstr = "invalid write to stack",
|
||||
.errstr_unpriv = "R1 stack pointer arithmetic goes out of range",
|
||||
},
|
||||
{
|
||||
"PTR_TO_STACK check low 7",
|
||||
@ -292,7 +296,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.result_unpriv = REJECT,
|
||||
.errstr_unpriv = "invalid stack off=0 size=1",
|
||||
.errstr_unpriv = "invalid write to stack R1 off=0 size=1",
|
||||
.result = ACCEPT,
|
||||
.retval = 42,
|
||||
},
|
||||
|
@ -108,7 +108,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.fixup_map_hash_8b = { 3 },
|
||||
.errstr_unpriv = "invalid indirect read from stack off -8+0 size 8",
|
||||
.errstr_unpriv = "invalid indirect read from stack R2 off -8+0 size 8",
|
||||
.result_unpriv = REJECT,
|
||||
.result = ACCEPT,
|
||||
},
|
||||
|
@ -18,7 +18,7 @@
|
||||
.prog_type = BPF_PROG_TYPE_LWT_IN,
|
||||
},
|
||||
{
|
||||
"variable-offset stack access",
|
||||
"variable-offset stack read, priv vs unpriv",
|
||||
.insns = {
|
||||
/* Fill the top 8 bytes of the stack */
|
||||
BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
|
||||
@ -63,7 +63,7 @@
|
||||
BPF_MOV64_IMM(BPF_REG_0, 0),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr = "R4 unbounded indirect variable offset stack access",
|
||||
.errstr = "invalid unbounded variable-offset indirect access to stack R4",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_SOCK_OPS,
|
||||
},
|
||||
@ -88,7 +88,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.fixup_map_hash_8b = { 5 },
|
||||
.errstr = "R2 max value is outside of stack bound",
|
||||
.errstr = "invalid variable-offset indirect access to stack R2",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_LWT_IN,
|
||||
},
|
||||
@ -113,7 +113,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.fixup_map_hash_8b = { 5 },
|
||||
.errstr = "R2 min value is outside of stack bound",
|
||||
.errstr = "invalid variable-offset indirect access to stack R2",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_LWT_IN,
|
||||
},
|
||||
@ -138,7 +138,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.fixup_map_hash_8b = { 5 },
|
||||
.errstr = "invalid indirect read from stack var_off",
|
||||
.errstr = "invalid indirect read from stack R2 var_off",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_LWT_IN,
|
||||
},
|
||||
@ -163,7 +163,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.fixup_map_hash_8b = { 5 },
|
||||
.errstr = "invalid indirect read from stack var_off",
|
||||
.errstr = "invalid indirect read from stack R2 var_off",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_LWT_IN,
|
||||
},
|
||||
@ -189,7 +189,7 @@
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.fixup_map_hash_8b = { 6 },
|
||||
.errstr_unpriv = "R2 stack pointer arithmetic goes out of range, prohibited for !root",
|
||||
.errstr_unpriv = "R2 variable stack access prohibited for !root",
|
||||
.result_unpriv = REJECT,
|
||||
.result = ACCEPT,
|
||||
.prog_type = BPF_PROG_TYPE_CGROUP_SKB,
|
||||
@ -217,7 +217,7 @@
|
||||
BPF_MOV64_IMM(BPF_REG_0, 0),
|
||||
BPF_EXIT_INSN(),
|
||||
},
|
||||
.errstr = "invalid indirect read from stack var_off",
|
||||
.errstr = "invalid indirect read from stack R4 var_off",
|
||||
.result = REJECT,
|
||||
.prog_type = BPF_PROG_TYPE_SOCK_OPS,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user