lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbEMVBMhN7cOCxzQ84wRXK3Um1Pc=gi_C7-GQ8WLpz+Uw@mail.gmail.com>
Date:   Fri, 27 Mar 2020 17:51:46 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Daniel Borkmann <daniel@...earbox.net>
Cc:     Alexei Starovoitov <alexei.starovoitov@...il.com>,
        Martynas Pumputis <m@...bda.lt>,
        Joe Stringer <joe@...d.net.nz>, bpf <bpf@...r.kernel.org>,
        Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next 7/7] bpf: add selftest cases for ctx_or_null
 argument type

On Fri, Mar 27, 2020 at 8:59 AM Daniel Borkmann <daniel@...earbox.net> wrote:
>
> Add various tests to make sure the verifier keeps catching them:
>
>   # ./test_verifier
>   [...]
>   #230/p pass ctx or null check, 1: ctx OK
>   #231/p pass ctx or null check, 2: null OK
>   #232/p pass ctx or null check, 3: 1 OK
>   #233/p pass ctx or null check, 4: ctx - const OK
>   #234/p pass ctx or null check, 5: null (connect) OK
>   #235/p pass ctx or null check, 6: null (bind) OK
>   #236/p pass ctx or null check, 7: ctx (bind) OK
>   #237/p pass ctx or null check, 8: null (bind) OK
>   [...]
>   Summary: 1595 PASSED, 0 SKIPPED, 0 FAILED
>
> Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
> ---
>  tools/testing/selftests/bpf/verifier/ctx.c | 105 +++++++++++++++++++++
>  1 file changed, 105 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/verifier/ctx.c b/tools/testing/selftests/bpf/verifier/ctx.c
> index 92762c08f5e3..93d6b1641481 100644
> --- a/tools/testing/selftests/bpf/verifier/ctx.c
> +++ b/tools/testing/selftests/bpf/verifier/ctx.c
> @@ -91,3 +91,108 @@
>         .result = REJECT,
>         .errstr = "variable ctx access var_off=(0x0; 0x4)",
>  },
> +{
> +       "pass ctx or null check, 1: ctx",
> +       .insns = {
> +               BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
> +                            BPF_FUNC_get_netns_cookie),

nit: seems like it deserves its own helper, e.g.,
BPF_CALL_HELPER(BPF_FUNC_get_netns_cookie)?

> +               BPF_MOV64_IMM(BPF_REG_0, 0),
> +               BPF_EXIT_INSN(),
> +       },
> +       .prog_type = BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
> +       .expected_attach_type = BPF_CGROUP_UDP6_SENDMSG,
> +       .result = ACCEPT,
> +},

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ