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: <186025b3-cea2-f07c-d2b9-8eadff6e0f4b@meta.com>
Date:   Wed, 24 May 2023 11:45:21 -0700
From:   Yonghong Song <yhs@...a.com>
To:     Arnd Bergmann <arnd@...db.de>, Arnd Bergmann <arnd@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Song Liu <song@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Masami Hiramatsu <mhiramat@...nel.org>
Cc:     stable@...r.kernel.org, Martin KaFai Lau <martin.lau@...ux.dev>,
        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>,
        Kumar Kartikeya Dwivedi <memxor@...il.com>,
        Dave Marchevsky <davemarchevsky@...com>,
        Joanne Koong <joannelkoong@...il.com>,
        Peter Zijlstra <peterz@...radead.org>, bpf@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] [v2] bpf: fix bpf_probe_read_kernel prototype
 mismatch



On 5/24/23 6:28 AM, Arnd Bergmann wrote:
> On Wed, May 24, 2023, at 05:12, Yonghong Song wrote:
>> On 5/23/23 12:43 PM, Arnd Bergmann wrote:
> 
>>> Aside from the warning, this addresses a bug on 32-bit architectures
>>> from incorrect argument passing with the mismatched prototype.
>>
>> Could you explain what is this '32-bit architectures ... incorrect
>> argument passing' thing?
> 
> I've expanded that paragraph now:
> 
> | Aside from the warning, this addresses a bug on 32-bit architectures
> | from incorrect argument passing with the mismatched prototype:
> | BPF_CALL_x() functions use 64-bit arguments that are passed in
> | pairs of register or on the stack on 32-bit architectures, while the
> | normal function uses one register per argument.
> 
> Let me know if you think I should put more details in there.

Please mention the function you try to address for the bug on
32-bit architecture is:

u64 __weak bpf_probe_read_kernel(void *dst, u32 size, const void 
*unsafe_ptr)

which will be incompatible with
BPF_CALL_3(bpf_probe_read_kernel, void *, dst, u32, size,
            const void *, unsafe_ptr)
in bpf_trace.c.

So you fixed this bug by using internal function 
bpf_probe_read_kernel_common() instead.

Thanks.

> 
>>> @@ -1635,11 +1636,13 @@ bool bpf_opcode_in_insntable(u8 code)
>>>    }
>>>    
>>>    #ifndef CONFIG_BPF_JIT_ALWAYS_ON
>>> -u64 __weak bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr)
>>> +#ifndef CONFIG_BPF_EVENTS
>>> +int bpf_probe_read_kernel_common(void * dst, u32 size, const void *unsafe_ptr)
>>
>> void * dst => void *dst
>>
> 
> Fixed now.
> 
> Thanks,
> 
>       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ