From: patchwork-bot+netdevbpf@kernel.org
To: Yonghong Song <yonghong.song@linux.dev>
Cc: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
daniel@iogearbox.net, kernel-team@fb.com, martin.lau@kernel.org,
houtao@huaweicloud.com
Subject: Re: [PATCH bpf-next v6 1/2] bpf: Fix a race condition between btf_put() and map_free()
Date: Fri, 15 Dec 2023 01:20:23 +0000 [thread overview]
Message-ID: <170260322398.10731.15714047011878677066.git-patchwork-notify@kernel.org> (raw)
In-Reply-To: <20231214203815.1469107-1-yonghong.song@linux.dev>
Hello:
This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Thu, 14 Dec 2023 12:38:15 -0800 you wrote:
> When running `./test_progs -j` in my local vm with latest kernel,
> I once hit a kasan error like below:
>
> [ 1887.184724] BUG: KASAN: slab-use-after-free in bpf_rb_root_free+0x1f8/0x2b0
> [ 1887.185599] Read of size 4 at addr ffff888106806910 by task kworker/u12:2/2830
> [ 1887.186498]
> [ 1887.186712] CPU: 3 PID: 2830 Comm: kworker/u12:2 Tainted: G OEL 6.7.0-rc3-00699-g90679706d486-dirty #494
> [ 1887.188034] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
> [ 1887.189618] Workqueue: events_unbound bpf_map_free_deferred
> [ 1887.190341] Call Trace:
> [ 1887.190666] <TASK>
> [ 1887.190949] dump_stack_lvl+0xac/0xe0
> [ 1887.191423] ? nf_tcp_handle_invalid+0x1b0/0x1b0
> [ 1887.192019] ? panic+0x3c0/0x3c0
> [ 1887.192449] print_report+0x14f/0x720
> [ 1887.192930] ? preempt_count_sub+0x1c/0xd0
> [ 1887.193459] ? __virt_addr_valid+0xac/0x120
> [ 1887.194004] ? bpf_rb_root_free+0x1f8/0x2b0
> [ 1887.194572] kasan_report+0xc3/0x100
> [ 1887.195085] ? bpf_rb_root_free+0x1f8/0x2b0
> [ 1887.195668] bpf_rb_root_free+0x1f8/0x2b0
> [ 1887.196183] ? __bpf_obj_drop_impl+0xb0/0xb0
> [ 1887.196736] ? preempt_count_sub+0x1c/0xd0
> [ 1887.197270] ? preempt_count_sub+0x1c/0xd0
> [ 1887.197802] ? _raw_spin_unlock+0x1f/0x40
> [ 1887.198319] bpf_obj_free_fields+0x1d4/0x260
> [ 1887.198883] array_map_free+0x1a3/0x260
> [ 1887.199380] bpf_map_free_deferred+0x7b/0xe0
> [ 1887.199943] process_scheduled_works+0x3a2/0x6c0
> [ 1887.200549] worker_thread+0x633/0x890
> [ 1887.201047] ? __kthread_parkme+0xd7/0xf0
> [ 1887.201574] ? kthread+0x102/0x1d0
> [ 1887.202020] kthread+0x1ab/0x1d0
> [ 1887.202447] ? pr_cont_work+0x270/0x270
> [ 1887.202954] ? kthread_blkcg+0x50/0x50
> [ 1887.203444] ret_from_fork+0x34/0x50
> [ 1887.203914] ? kthread_blkcg+0x50/0x50
> [ 1887.204397] ret_from_fork_asm+0x11/0x20
> [ 1887.204913] </TASK>
> [ 1887.204913] </TASK>
> [ 1887.205209]
> [ 1887.205416] Allocated by task 2197:
> [ 1887.205881] kasan_set_track+0x3f/0x60
> [ 1887.206366] __kasan_kmalloc+0x6e/0x80
> [ 1887.206856] __kmalloc+0xac/0x1a0
> [ 1887.207293] btf_parse_fields+0xa15/0x1480
> [ 1887.207836] btf_parse_struct_metas+0x566/0x670
> [ 1887.208387] btf_new_fd+0x294/0x4d0
> [ 1887.208851] __sys_bpf+0x4ba/0x600
> [ 1887.209292] __x64_sys_bpf+0x41/0x50
> [ 1887.209762] do_syscall_64+0x4c/0xf0
> [ 1887.210222] entry_SYSCALL_64_after_hwframe+0x63/0x6b
> [ 1887.210868]
> [ 1887.211074] Freed by task 36:
> [ 1887.211460] kasan_set_track+0x3f/0x60
> [ 1887.211951] kasan_save_free_info+0x28/0x40
> [ 1887.212485] ____kasan_slab_free+0x101/0x180
> [ 1887.213027] __kmem_cache_free+0xe4/0x210
> [ 1887.213514] btf_free+0x5b/0x130
> [ 1887.213918] rcu_core+0x638/0xcc0
> [ 1887.214347] __do_softirq+0x114/0x37e
>
> [...]
Here is the summary with links:
- [bpf-next,v6,1/2] bpf: Fix a race condition between btf_put() and map_free()
https://git.kernel.org/bpf/bpf-next/c/59e5791f59dd
- [bpf-next,v6,2/2] selftests/bpf: Remove flaky test_btf_id test
https://git.kernel.org/bpf/bpf-next/c/56925f389e15
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
prev parent reply other threads:[~2023-12-15 1:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-14 20:38 [PATCH bpf-next v6 1/2] bpf: Fix a race condition between btf_put() and map_free() Yonghong Song
2023-12-14 20:38 ` [PATCH bpf-next v6 2/2] selftests/bpf: Remove flaky test_btf_id test Yonghong Song
2023-12-15 1:20 ` patchwork-bot+netdevbpf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=170260322398.10731.15714047011878677066.git-patchwork-notify@kernel.org \
--to=patchwork-bot+netdevbpf@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=houtao@huaweicloud.com \
--cc=kernel-team@fb.com \
--cc=martin.lau@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox