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: <1d5a490c-b3bd-a029-15b5-77b72e545b20@huawei.com>
Date:   Wed, 26 Oct 2022 20:06:51 +0800
From:   Xu Kuohai <xukuohai@...wei.com>
To:     Bagas Sanjaya <bagasdotme@...il.com>,
        Alexei Starovoitov <alexei.starovoitov@...il.com>
CC:     Xu Kuohai <xukuohai@...weicloud.com>, bpf <bpf@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        John Fastabend <john.fastabend@...il.com>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <martin.lau@...ux.dev>,
        Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
        KP Singh <kpsingh@...nel.org>,
        Stanislav Fomichev <sdf@...gle.com>,
        Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
        "David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH bpf-next] bpf: Fix a typo in comment for DFS algorithm

On 10/26/2022 3:52 PM, Bagas Sanjaya wrote:
> On Tue, Oct 25, 2022 at 11:32:55PM -0700, Alexei Starovoitov wrote:
>> On Tue, Oct 25, 2022 at 7:42 PM Xu Kuohai <xukuohai@...weicloud.com> wrote:
>>>
>>> From: Xu Kuohai <xukuohai@...wei.com>
>>>
>>> There is a typo in comment for DFS algorithm in bpf/verifier.c. The top
>>> element should not be popped until all its neighbors have been checked.
>>> Fix it.
>>>
>>> Fixes: 475fb78fbf48 ("bpf: verifier (add branch/goto checks)")
>>> Signed-off-by: Xu Kuohai <xukuohai@...wei.com>
>>> ---
>>>   kernel/bpf/verifier.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
>>> index b83a8d420520..96ba5ea6d1a6 100644
>>> --- a/kernel/bpf/verifier.c
>>> +++ b/kernel/bpf/verifier.c
>>> @@ -10662,7 +10662,7 @@ static int check_return_code(struct bpf_verifier_env *env)
>>>    * 3      let S be a stack
>>>    * 4      S.push(v)
>>>    * 5      while S is not empty
>>> - * 6            t <- S.pop()
>>> + * 6            t <- S.top()
>>
>> Even with this fix the comment is not quite accurate.
>> I wonder whether we should keep it or delete it completely.
>> At least please use 'peek' instead of 'top'.
> 
> I think the comment should be in words (like other code comments in the
> kernel) instead.
> 

The beginning of the comment already says this is a piece of pseudo code. And
I don't think it's clearer to describe the algorithm in words than to describe
it in pseudo code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ