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: <58c3e30e-f283-5d50-5aba-1fe16f1257a3@huawei.com>
Date:   Wed, 30 Nov 2022 09:17:11 +0800
From:   Zheng Yejian <zhengyejian1@...wei.com>
To:     David Vernet <void@...ifault.com>
CC:     <ast@...nel.org>, <daniel@...earbox.net>, <andrii@...nel.org>,
        <martin.lau@...ux.dev>, <song@...nel.org>, <yhs@...com>,
        <john.fastabend@...il.com>, <kpsingh@...nel.org>, <sdf@...gle.com>,
        <haoluo@...gle.com>, <jolsa@...nel.org>, <corbet@....net>,
        <bpf@...r.kernel.org>, <linux-doc@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf] bpf, docs: Correct the example of BPF_XOR

On 2022/11/30 02:54, David Vernet wrote:
> On Tue, Nov 29, 2022 at 09:45:58PM +0800, Zheng Yejian wrote:
>> Refer to description of BPF_XOR, dst_reg should be used but not src_reg
>> in the examples.
>>
>> Signed-off-by: Zheng Yejian <zhengyejian1@...wei.com>
>> ---
>>   Documentation/bpf/instruction-set.rst | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/bpf/instruction-set.rst b/Documentation/bpf/instruction-set.rst
>> index 5d798437dad4..e672d5ec6cc7 100644
>> --- a/Documentation/bpf/instruction-set.rst
>> +++ b/Documentation/bpf/instruction-set.rst
>> @@ -122,11 +122,11 @@ BPF_END   0xd0   byte swap operations (see `Byte swap instructions`_ below)
>>   
>>   ``BPF_XOR | BPF_K | BPF_ALU`` means::
>>   
>> -  src_reg = (u32) src_reg ^ (u32) imm32
>> +  dst_reg = (u32) dst_reg ^ (u32) imm32
> 
> Shouldn't this be
> 
> dst_reg = (u32) dst_reg ^ (u32) src_reg
> 
> Same idea below for 64 bit

See Chapter 'Instruction classes', BPF_K means "use 32-bit immediate as 
source operand", so it should be 'imm32' instead of 'src_reg'.

> 
>>   
>>   ``BPF_XOR | BPF_K | BPF_ALU64`` means::
>>   
>> -  src_reg = src_reg ^ imm32
>> +  dst_reg = dst_reg ^ imm32
>>   
>>   
>>   Byte swap instructions
>> -- 
>> 2.25.1
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ