[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <92c38851-5435-4562-9dbc-4270d67af0bc@linux.dev>
Date: Mon, 20 May 2024 19:12:26 -0700
From: Yonghong Song <yonghong.song@...ux.dev>
To: Ivan Babrou <ivan@...udflare.com>, bpf@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, kernel-team@...udflare.com,
Quentin Monnet <quentin@...valent.com>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>, Song Liu <song@...nel.org>,
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>, Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>, Tom Rix <trix@...hat.com>,
Raman Shukhau <ramasha@...com>
Subject: Re: [PATCH] bpftool: un-const bpf_func_info to fix it for llvm 17 and
newer
On 5/20/24 4:51 PM, Ivan Babrou wrote:
> LLVM 17 started treating const structs as constants:
>
> * https://github.com/llvm/llvm-project/commit/0b2d5b967d98
>
> Combined with pointer laundering via ptr_to_u64, which takes a const ptr,
> but in reality treats the underlying memory as mutable, this makes clang
> always pass zero to btf__type_by_id, which breaks full name resolution.
>
> Disassembly before (LLVM 16) and after (LLVM 17):
>
> - 8b 75 cc mov -0x34(%rbp),%esi
> - e8 47 8d 02 00 call 3f5b0 <btf__type_by_id>
> + 31 f6 xor %esi,%esi
> + e8 a9 8c 02 00 call 3f510 <btf__type_by_id>
>
> It's a bigger project to fix this properly (and a question whether LLVM
> itself should detect this), but for right now let's just fix bpftool.
>
> For more information, see this thread in bpf mailing list:
>
> * https://lore.kernel.org/bpf/CABWYdi0ymezpYsQsPv7qzpx2fWuTkoD1-wG1eT-9x-TSREFrQg@mail.gmail.com/T/
>
> Fixes: b662000aff84 ("bpftool: Adding support for BTF program names")
> Signed-off-by: Ivan Babrou <ivan@...udflare.com>
Acked-by: Yonghong Song <yonghong.song@...ux.dev>
Powered by blists - more mailing lists