[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b188f97-f5ef-8f06-50a2-26a43b58f7ed@iogearbox.net>
Date: Thu, 11 Jul 2024 17:55:43 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Puranjay Mohan <puranjay@...nel.org>, Manu Bretelle <chantra@...a.com>,
KP Singh <kpsingh@...nel.org>
Cc: Andrii Nakryiko <andrii@...nel.org>, Eduard Zingerman
<eddyz87@...il.com>, Mykola Lysenko <mykolal@...a.com>,
Alexei Starovoitov <ast@...nel.org>, Martin KaFai Lau
<martin.lau@...ux.dev>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>,
Stanislav Fomichev <sdf@...gle.com>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, 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>,
Florent Revest <revest@...gle.com>
Subject: Re: [PATCH bpf] selftests/bpf: DENYLIST.aarch64: Remove fexit_sleep
On 7/11/24 4:00 PM, Puranjay Mohan wrote:
>
> Hi,
> I was able find the root cause of this bug and will send a fix soon!
>
>> Unable to handle kernel paging request at virtual address ffff0000c2a80e68
>
> We are running this test on Qemu with '-cpu max', this means 52-bit
> virtual addresses are being used.
>
> The trampolines generation code has the following two lines:
>
> emit_addr_mov_i64(A64_R(0), (const u64)im, ctx);
> emit_call((const u64)__bpf_tramp_enter, ctx);
>
> here the address of struct bpf_tramp_image is moved to R0 and passed as
> an argument to __bpf_tramp_enter().
>
> emit_addr_mov_i64() assumes that the address passed to it is in the
> vmalloc space and uses at most 48 bits. It sets all the remaining bits
> to 1.
>
> but struct bpf_tramp_image is allocated using kzalloc() and when 52-bit
> VAs are used, its address is not guaranteed to be 48-bit, therefore we
> see this bug, where 0xfff[0]0000c2a80e68 is converted to
> 0xfff[f]0000c2a80e68 when the trampoline is generated.
>
> The fix would be use emit_a64_mov_i64() for moving this address into R0.
Excellent find!
Powered by blists - more mailing lists