Re: [PATCH v3 bpf-next 0/9] bpf: bounded loops and other features

2019-06-18 Thread Paul Chaignon
On Mon, Jun 17, 2019 at 06:57PM, Alexei Starovoitov wrote: > On 6/17/19 9:39 AM, Andrii Nakryiko wrote: > > On Sat, Jun 15, 2019 at 12:12 PM Alexei Starovoitov wrote: > >> > >> v2->v3: fixed issues in backtracking pointed out by Andrii. > >> The next step is to add a lot more tests for backtrackin

[PATCH bpf v3 2/2] selftests/bpf: test cases for pkt/null checks in subprogs

2019-04-24 Thread Paul Chaignon
_end) { 4: return ptr <= pkt_end; 5: } 6: if (ret) 7: value = *(u8 *)ctx.pkt; Signed-off-by: Paul Chaignon --- tools/testing/selftests/bpf/verifier/calls.c | 25 +++ .../bpf/verifier/direct_packet_access.c | 22 2 files changed, 47 insertions(+)

[PATCH bpf v3 1/2] bpf: mark registers in all frames after pkt/null checks

2019-04-24 Thread Paul Chaignon
rn 1; In the above, mark_ptr_or_null_regs will warn on line 6 because it will try to free the reference state, even though it was already freed on line 3. Fixes: f4d7e40a5b71 ("bpf: introduce function calls (verification)") Signed-off-by: Paul Chaignon --- kernel/bpf/v

[PATCH bpf v3 0/2] bpf: mark registers in all frames after pkt/null checks

2019-04-24 Thread Paul Chaignon
ecause of the above changes. Changes in v2: - Fix example codes in commit message. Paul Chaignon (2): bpf: mark registers in all frames after pkt/null checks selftests/bpf: test cases for pkt/null checks in subprogs kernel/bpf/verifier.c | 76 +++

Re: [PATCH bpf v2 1/2] bpf: mark registers as safe or unknown in all frames

2019-04-24 Thread Paul Chaignon
On Tue, Apr 23, 2019 01:47AM, Daniel Borkmann wrote: > On 04/22/2019 08:34 PM, Paul Chaignon wrote: > > In case of a null check on a pointer inside a subprog, we should mark all > > registers with this pointer as either safe or unknown, in both the current > > and previous fra

[PATCH bpf v2 2/2] selftests/bpf: test case for pointer null check in subprog

2019-04-22 Thread Paul Chaignon
ed-off-by: Paul Chaignon --- tools/testing/selftests/bpf/verifier/calls.c | 25 1 file changed, 25 insertions(+) diff --git a/tools/testing/selftests/bpf/verifier/calls.c b/tools/testing/selftests/bpf/verifier/calls.c index fb11240b758b..9093a8f64dc6 100644 --- a/tools/testing/

[PATCH bpf v2 1/2] bpf: mark registers as safe or unknown in all frames

2019-04-22 Thread Paul Chaignon
free the reference state, even though it was already freed on line 3. Fixes: f4d7e40a5b71 ("bpf: introduce function calls (verification)") Signed-off-by: Paul Chaignon --- kernel/bpf/verifier.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/verif

[PATCH bpf v2 0/2] bpf: mark registers as safe or unknown in all frames

2019-04-22 Thread Paul Chaignon
bove, mark_ptr_or_null_regs will warn on line 6 because it will try to free the reference state, even though it was already freed on line 3. Changelogs: Changes in v2: - Fix example codes in commit message. Paul Chaignon (2): bpf: mark registers as safe or unknown in all frames selftests/bpf:

Re: [PATCH bpf 0/2] bpf: mark registers as safe or unknown in all frames

2019-04-22 Thread Paul Chaignon
On Mon, Apr 22, 2019 04:57PM, Yonghong Song wrote: > On 4/20/19 5:38 AM, Paul Chaignon wrote: > > In case of a null check on a pointer inside a subprog, we should mark all > > registers with this pointer as either safe or unknown, in both the current > > and previous fra

[PATCH bpf 1/2] bpf: mark registers as safe or unknown in all frames

2019-04-20 Thread Paul Chaignon
y to free the reference state, even though it was already freed on line 3. Fixes: f4d7e40a5b71 ("bpf: introduce function calls (verification)") Signed-off-by: Paul Chaignon --- kernel/bpf/verifier.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/bpf/verif

[PATCH bpf 2/2] selftests/bpf: test case for pointer null check in subprog

2019-04-20 Thread Paul Chaignon
ed-off-by: Paul Chaignon --- tools/testing/selftests/bpf/verifier/calls.c | 25 1 file changed, 25 insertions(+) diff --git a/tools/testing/selftests/bpf/verifier/calls.c b/tools/testing/selftests/bpf/verifier/calls.c index fb11240b758b..9093a8f64dc6 100644 --- a/tools/testing/

[PATCH bpf 0/2] bpf: mark registers as safe or unknown in all frames

2019-04-20 Thread Paul Chaignon
bove, mark_ptr_or_null_regs will warn on line 6 because it will try to free the reference state, even though it was already freed on line 3. Paul Chaignon (2): bpf: mark registers as safe or unknown in all frames selftests/bpf: test case for pointer null check in subprog kernel/bpf/verifi

Re: [PATCH bpf] bpf: report verifier bugs as warnings

2019-04-03 Thread Paul Chaignon
On Tue, Apr 02, 2019 at 10:39:29AM -0700, Alexei Starovoitov wrote: > On Tue, Apr 02, 2019 at 04:37:19PM +0200, Daniel Borkmann wrote: > > On 04/02/2019 01:58 PM, Paul Chaignon wrote: > > > Three checks for verifier bugs were introduced in commit f4d7e40 ("bpf: > &g

[PATCH bpf] bpf: report verifier bugs as warnings

2019-04-02 Thread Paul Chaignon
Three checks for verifier bugs were introduced in commit f4d7e40 ("bpf: introduce function calls (verification)"). The bugs were reported as incorrect programs instead of kernel warnings as the present patch implements. Signed-off-by: Paul Chaignon --- kernel/bpf/verif

Re: [PATCH bpf-next 0/2] bpf: remove incorrect 'verifier bug' warning

2019-03-21 Thread Paul Chaignon
On Wed, Mar 20, 2019 at 11:31PM, Yonghong Song wrote: > On 3/20/19 5:57 AM, Paul Chaignon wrote: > > The BPF verifier checks the maximum number of call stack frames twice, > > first in the main CFG traversal (do_check) and then in a subsequent > > traversal (check_max_stack_d

[PATCH bpf-next 2/2] selftests/bpf: test case for invalid call stack in dead code

2019-03-20 Thread Paul Chaignon
This patch adds a test case with an excessive number of call stack frames in dead code. Signed-off-by: Paul Chaignon Tested-by: Xiao Han --- tools/testing/selftests/bpf/verifier/calls.c | 38 1 file changed, 38 insertions(+) diff --git a/tools/testing/selftests/bpf

[PATCH bpf-next 1/2] bpf: remove incorrect 'verifier bug' warning

2019-03-20 Thread Paul Chaignon
ion of how invalid dead code should be treated. This patch implements the conservative option and rejects such code. Signed-off-by: Paul Chaignon Tested-by: Xiao Han --- kernel/bpf/verifier.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/verifier.c b/

[PATCH bpf-next 0/2] bpf: remove incorrect 'verifier bug' warning

2019-03-20 Thread Paul Chaignon
ion of how invalid dead code should be treated. The first patch implements the conservative option and rejects such code; the second adds a test case. Paul Chaignon (2): bpf: remove incorrect 'verifier bug' warning selftests/bpf: test case for invalid call stack in dead code k

Re: [PATCH bpf-next v4 1/2] bpf: allow map helpers access to map values directly

2018-04-24 Thread Paul Chaignon
On 04/23/2018 11:18 PM +0200, Daniel Borkmann wrote: > On 04/22/2018 11:52 PM, Paul Chaignon wrote: > > Helpers that expect ARG_PTR_TO_MAP_KEY and ARG_PTR_TO_MAP_VALUE can only > > access stack and packet memory. Allow these helpers to directly access > > map values by pass

[PATCH bpf-next v5 2/2] tools/bpf: add verifier tests for accesses to map values

2018-04-24 Thread Paul Chaignon
This patch adds new test cases for accesses to map values from map helpers. Signed-off-by: Paul Chaignon --- tools/testing/selftests/bpf/test_verifier.c | 266 1 file changed, 266 insertions(+) diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools

[PATCH bpf-next v5 1/2] bpf: allow map helpers access to map values directly

2018-04-24 Thread Paul Chaignon
di); u64 *count = bpf_map_lookup_elem(&counts, info); (*count)++; } Signed-off-by: Paul Chaignon --- kernel/bpf/verifier.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 5dd1dcb..eb1

[PATCH bpf-next v5 0/2] bpf: allow map helpers access to map values directly

2018-04-24 Thread Paul Chaignon
cases for adjusted maps. Paul Chaignon (2): bpf: allow map helpers access to map values directly tools/bpf: add verifier tests for accesses to map values kernel/bpf/verifier.c | 24 +-- tools/testing/selftests/bpf/test_verifier.c | 266 2

[PATCH bpf-next v4 2/2] tools/bpf: add verifier tests for accesses to map

2018-04-22 Thread Paul Chaignon
This patch adds new test cases for accesses to map values from map helpers. Signed-off-by: Paul Chaignon --- tools/testing/selftests/bpf/test_verifier.c | 266 1 file changed, 266 insertions(+) diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools

[PATCH bpf-next v4 1/2] bpf: allow map helpers access to map values directly

2018-04-22 Thread Paul Chaignon
di); u64 *count = bpf_map_lookup_elem(&counts, info); (*count)++; } Signed-off-by: Paul Chaignon --- kernel/bpf/verifier.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 5dd1dcb902bf..70e00beade03 100644

[PATCH bpf-next v4 0/2] bpf: allow map helpers access to map values directly

2018-04-22 Thread Paul Chaignon
. Previous versions of this patchset were sent on the iovisor-dev mailing list only. Changelogs: Changes in v4: - Rebase. Changes in v3: - Bug fixes. - Negative test cases. Changes in v2: - Additional test cases for adjusted maps. Paul Chaignon (2): bpf: allow map helpers