[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQ+FuDDNZ=toHYtrQ=-u+ZSx2Xb2R-k0=grKoy5AfODkpw@mail.gmail.com>
Date: Tue, 18 Jan 2022 14:52:40 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Network Development <netdev@...r.kernel.org>,
netfilter-devel <netfilter-devel@...r.kernel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
Maxim Mikityanskiy <maximmi@...dia.com>,
Pablo Neira Ayuso <pablo@...filter.org>,
Florian Westphal <fw@...len.de>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [PATCH bpf-next v8 10/10] selftests/bpf: Add test for race in btf_try_get_module
On Fri, Jan 14, 2022 at 8:41 AM Kumar Kartikeya Dwivedi
<memxor@...il.com> wrote:
>
> This adds a complete test case to ensure we never take references to
> modules not in MODULE_STATE_LIVE, which can lead to UAF, and it also
> ensures we never access btf->kfunc_set_tab in an inconsistent state.
>
> The test uses userfaultfd to artificially widen the race.
>
> When run on an unpatched kernel, it leads to the following splat:
>
> [root@(none) bpf]# ./test_progs -t bpf_mod_race/ksym
> [ 55.498171] BUG: unable to handle page fault for address: fffffbfff802548b [ 55.499206] #PF: supervisor read access in kernel mode
> [ 55.499855] #PF: error_code(0x0000) - not-present page
> [ 55.500555] PGD a4fa9067 P4D a4fa9067 PUD a4fa5067 PMD 1b44067 PTE 0
> [ 55.501499] Oops: 0000 [#1] PREEMPT SMP KASAN NOPTI
> [ 55.502195] CPU: 0 PID: 83 Comm: kworker/0:2 Tainted: G OE 5.16.0-rc4+ #151 [ 55.503388] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ArchLinux 1.15.0-1 04/01/2014
The commit log was messed up in a few places.
I've cleaned it up while applying.
Thanks!
Powered by blists - more mailing lists