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] [day] [month] [year] [list]
Message-ID: <PS1PR0601MB37373945FE6F9EC0A42AD590BD2FA@PS1PR0601MB3737.apcprd06.prod.outlook.com>
Date:   Wed, 5 Jul 2023 13:38:24 +0000
From:   王明-软件底层技术部 
        <machel@...o.com>
To:     Daniel Borkmann <daniel@...earbox.net>
CC:     Alexei Starovoitov <ast@...nel.org>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <martin.lau@...ux.dev>,
        Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Stanislav Fomichev <sdf@...gle.com>,
        Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
        Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: 回复: [PATCH v1] selftests:bpf:Fix repeated initialization

Thank you, but I don't understand the error.

-----邮件原件-----
发件人: Daniel Borkmann <daniel@...earbox.net> 
发送时间: 2023年7月5日 21:32
收件人: 王明-软件底层技术部 <machel@...o.com>; Alexei Starovoitov <ast@...nel.org>; Andrii Nakryiko <andrii@...nel.org>; Martin KaFai Lau <martin.lau@...ux.dev>; Song Liu <song@...nel.org>; Yonghong Song <yhs@...com>; John Fastabend <john.fastabend@...il.com>; KP Singh <kpsingh@...nel.org>; Stanislav Fomichev <sdf@...gle.com>; Hao Luo <haoluo@...gle.com>; Jiri Olsa <jolsa@...nel.org>; Mykola Lysenko <mykolal@...com>; Shuah Khan <shuah@...nel.org>; bpf@...r.kernel.org; linux-kselftest@...r.kernel.org; linux-kernel@...r.kernel.org
抄送: opensource.kernel <opensource.kernel@...o.com>
主题: Re: [PATCH v1] selftests:bpf:Fix repeated initialization

On 7/5/23 2:33 PM, Wang Ming wrote:
> In use_missing_map function, value is
> initialized twice.There is no
> connection between the two assignment.
> This patch could fix this bug.

Please never submit patches where you are just speculating and did not even bother to run BPF selftests !

Otherwise you would have seen that your change is breaking it :

Error: #126 log_fixup
Error: #126/5 log_fixup/missing_map
   Error: #126/5 log_fixup/missing_map
   missing_map:PASS:skel_open 0 nsec
   libbpf: prog 'use_missing_map': BPF program load failed: Invalid argument
   libbpf: prog 'use_missing_map': failed to load: -22
   libbpf: failed to load object 'test_log_fixup'
   libbpf: failed to load BPF skeleton 'test_log_fixup': -22
   missing_map:PASS:load_fail 0 nsec
   missing_map:PASS:existing_map_autocreate 0 nsec
   missing_map:PASS:missing_map_autocreate 0 nsec
   missing_map:FAIL:log_buf unexpected log_buf: '8: <invalid BPF map reference>
   BPF map 'missing_map' is referenced but wasn't created
   ' is not a substring of 'reg type unsupported for arg#0 function use_missing_map#20
   0: R1=ctx(off=0,imm=0) R10=fp0
   ; int use_missing_map(const void *ctx)
   0: (b4) w1 = 0                        ; R1_w=0
   ; int zero = 0;
   1: (63) *(u32 *)(r10 -4) = r1         ; R1_w=0 R10=fp0 fp-8=0000????
   2: (bf) r2 = r10                      ; R2_w=fp0 R10=fp0
   ;
   3: (07) r2 += -4                      ; R2_w=fp-4
   ; return bpf_map_lookup_elem(&missing_map, &zero) != NULL;
   4: <invalid BPF map reference>
   BPF map 'missing_map' is referenced but wasn't created
   processed 5 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

> Signed-off-by: Wang Ming <machel@...o.com>
> ---
>   tools/testing/selftests/bpf/progs/test_log_fixup.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/progs/test_log_fixup.c 
> b/tools/testing/selftests/bpf/progs/test_log_fixup.c
> index 1bd48feaaa42..1c49b2f9be6c 100644
> --- a/tools/testing/selftests/bpf/progs/test_log_fixup.c
> +++ b/tools/testing/selftests/bpf/progs/test_log_fixup.c
> @@ -52,13 +52,9 @@ struct {
>   SEC("?raw_tp/sys_enter")
>   int use_missing_map(const void *ctx)
>   {
> -	int zero = 0, *value;
> +	int zero = 0;
>   
> -	value = bpf_map_lookup_elem(&existing_map, &zero);
> -
> -	value = bpf_map_lookup_elem(&missing_map, &zero);
> -
> -	return value != NULL;
> +	return bpf_map_lookup_elem(&missing_map, &zero) != NULL;
>   }
>   
>   extern int bpf_nonexistent_kfunc(void) __ksym __weak;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ