Message ID | 20220301065745.1634848-6-memxor@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | BPF |
Headers | show |
Series | Fixes for bad PTR_TO_BTF_ID offset | expand |
On Mon, Feb 28, 2022 at 10:58 PM Kumar Kartikeya Dwivedi <memxor@gmail.com> wrote: > > Verifier for negative offset case returns a different, more clear error > message. Update existing verifier selftests to work with that. > > Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> > --- > tools/testing/selftests/bpf/verifier/bounds_deduction.c | 2 +- > tools/testing/selftests/bpf/verifier/ctx.c | 8 ++++---- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/tools/testing/selftests/bpf/verifier/bounds_deduction.c b/tools/testing/selftests/bpf/verifier/bounds_deduction.c > index 91869aea6d64..3931c481e30c 100644 > --- a/tools/testing/selftests/bpf/verifier/bounds_deduction.c > +++ b/tools/testing/selftests/bpf/verifier/bounds_deduction.c > @@ -105,7 +105,7 @@ > BPF_EXIT_INSN(), > }, > .errstr_unpriv = "R1 has pointer with unsupported alu operation", > - .errstr = "dereference of modified ctx ptr", > + .errstr = "negative offset ctx ptr R1 off=-1 disallowed", Should this be a part of patch 3 to avoid breaking bisect?
On Thu, Mar 03, 2022 at 04:15:06AM IST, Alexei Starovoitov wrote: > On Mon, Feb 28, 2022 at 10:58 PM Kumar Kartikeya Dwivedi > <memxor@gmail.com> wrote: > > > > Verifier for negative offset case returns a different, more clear error > > message. Update existing verifier selftests to work with that. > > > > Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> > > --- > > tools/testing/selftests/bpf/verifier/bounds_deduction.c | 2 +- > > tools/testing/selftests/bpf/verifier/ctx.c | 8 ++++---- > > 2 files changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/tools/testing/selftests/bpf/verifier/bounds_deduction.c b/tools/testing/selftests/bpf/verifier/bounds_deduction.c > > index 91869aea6d64..3931c481e30c 100644 > > --- a/tools/testing/selftests/bpf/verifier/bounds_deduction.c > > +++ b/tools/testing/selftests/bpf/verifier/bounds_deduction.c > > @@ -105,7 +105,7 @@ > > BPF_EXIT_INSN(), > > }, > > .errstr_unpriv = "R1 has pointer with unsupported alu operation", > > - .errstr = "dereference of modified ctx ptr", > > + .errstr = "negative offset ctx ptr R1 off=-1 disallowed", > > Should this be a part of patch 3 to avoid breaking bisect? Right, will squash into patch 3 in v2. -- Kartikeya
diff --git a/tools/testing/selftests/bpf/verifier/bounds_deduction.c b/tools/testing/selftests/bpf/verifier/bounds_deduction.c index 91869aea6d64..3931c481e30c 100644 --- a/tools/testing/selftests/bpf/verifier/bounds_deduction.c +++ b/tools/testing/selftests/bpf/verifier/bounds_deduction.c @@ -105,7 +105,7 @@ BPF_EXIT_INSN(), }, .errstr_unpriv = "R1 has pointer with unsupported alu operation", - .errstr = "dereference of modified ctx ptr", + .errstr = "negative offset ctx ptr R1 off=-1 disallowed", .result = REJECT, .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, }, diff --git a/tools/testing/selftests/bpf/verifier/ctx.c b/tools/testing/selftests/bpf/verifier/ctx.c index 23080862aafd..e47a001c2bcd 100644 --- a/tools/testing/selftests/bpf/verifier/ctx.c +++ b/tools/testing/selftests/bpf/verifier/ctx.c @@ -58,7 +58,7 @@ }, .prog_type = BPF_PROG_TYPE_SCHED_CLS, .result = REJECT, - .errstr = "dereference of modified ctx ptr", + .errstr = "negative offset ctx ptr R1 off=-612 disallowed", }, { "pass modified ctx pointer to helper, 2", @@ -71,8 +71,8 @@ }, .result_unpriv = REJECT, .result = REJECT, - .errstr_unpriv = "dereference of modified ctx ptr", - .errstr = "dereference of modified ctx ptr", + .errstr_unpriv = "negative offset ctx ptr R1 off=-612 disallowed", + .errstr = "negative offset ctx ptr R1 off=-612 disallowed", }, { "pass modified ctx pointer to helper, 3", @@ -141,7 +141,7 @@ .prog_type = BPF_PROG_TYPE_CGROUP_SOCK_ADDR, .expected_attach_type = BPF_CGROUP_UDP6_SENDMSG, .result = REJECT, - .errstr = "dereference of modified ctx ptr", + .errstr = "negative offset ctx ptr R1 off=-612 disallowed", }, { "pass ctx or null check, 5: null (connect)",
Verifier for negative offset case returns a different, more clear error message. Update existing verifier selftests to work with that. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> --- tools/testing/selftests/bpf/verifier/bounds_deduction.c | 2 +- tools/testing/selftests/bpf/verifier/ctx.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)