https://bugzilla.kernel.org/show_bug.cgi?id=220889
Bug ID: 220889
Summary: KASAN: invalid-access in
bpf_patch_insn_data+0x22c/0x2f0
Product: Memory Management
Version: 2.5
Kernel Version: v6.18
Hardware: ARM
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: Sanitizers
Assignee:
mm_san...@kernel-bugs.kernel.org
Reporter:
joonk...@samsung.com
CC:
kasa...@googlegroups.com
Regression: No
When SW tag KASAN is enabled, we got kernel crash from bpf/verifier.
I found that it occurred only from 6.18, not 6.12 LTS we're working on.
After some tests, I found that the device is booted when 2 commits are
reverted.
bpf: potential double-free of env->insn_aux_data
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b13448dd64e27752fad252cec7da1a50ab9f0b6f
bpf: use realloc in bpf_patch_insn_data
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=77620d1267392b1a34bfc437d2adea3006f95865
==================================================================
[ 79.419177] [4: netbpfload: 825] BUG: KASAN: invalid-access in
bpf_patch_insn_data+0x22c/0x2f0
[ 79.419415] [4: netbpfload: 825] Write of size 27896 at addr
25ffffc08e6314d0 by task netbpfload/825
[ 79.419984] [4: netbpfload: 825] Pointer tag: [25], memory tag: [fa]
[ 79.425193] [4: netbpfload: 825]
[ 79.427365] [4: netbpfload: 825] CPU: 4 UID: 0 PID: 825 Comm:
netbpfload Tainted: G OE
6.18.0-rc6-android17-0-gd28deb424356-4k #1 PREEMPT
92293e52a7788dc6ec1b9dff6625aaee925f3475
[ 79.427374] [4: netbpfload: 825] Tainted: [O]=OOT_MODULE,
[E]=UNSIGNED_MODULE
[ 79.427378] [4: netbpfload: 825] Hardware name: Samsung ERD9965 board
based on S5E9965 (DT)
[ 79.427382] [4: netbpfload: 825] Call trace:
[ 79.427385] [4: netbpfload: 825] show_stack+0x18/0x28 (C)
[ 79.427394] [4: netbpfload: 825] __dump_stack+0x28/0x3c
[ 79.427401] [4: netbpfload: 825] dump_stack_lvl+0x7c/0xa8
[ 79.427407] [4: netbpfload: 825] print_address_description+0x7c/0x20c
[ 79.427414] [4: netbpfload: 825] print_report+0x70/0x8c
[ 79.427421] [4: netbpfload: 825] kasan_report+0xb4/0x114
[ 79.427427] [4: netbpfload: 825] kasan_check_range+0x94/0xa0
[ 79.427432] [4: netbpfload: 825] __asan_memmove+0x54/0x88
[ 79.427437] [4: netbpfload: 825] bpf_patch_insn_data+0x22c/0x2f0
[ 79.427442] [4: netbpfload: 825] bpf_check+0x2b44/0x8c34
[ 79.427449] [4: netbpfload: 825] bpf_prog_load+0x8dc/0x990
[ 79.427453] [4: netbpfload: 825] __sys_bpf+0x300/0x4c8
[ 79.427458] [4: netbpfload: 825] __arm64_sys_bpf+0x48/0x64
[ 79.427465] [4: netbpfload: 825] invoke_syscall+0x6c/0x13c
[ 79.427471] [4: netbpfload: 825] el0_svc_common+0xf8/0x138
[ 79.427478] [4: netbpfload: 825] do_el0_svc+0x30/0x40
[ 79.427484] [4: netbpfload: 825] el0_svc+0x38/0x8c
[ 79.427491] [4: netbpfload: 825] el0t_64_sync_handler+0x68/0xdc
[ 79.427497] [4: netbpfload: 825] el0t_64_sync+0x1b8/0x1bc
[ 79.427502] [4: netbpfload: 825]
[ 79.545586] [4: netbpfload: 825] The buggy address belongs to a 8-page
vmalloc region starting at 0x25ffffc08e631000 allocated at
bpf_patch_insn_data+0x8c/0x2f0
[ 79.558777] [4: netbpfload: 825] The buggy address belongs to the
physical page:
[ 79.565029] [4: netbpfload: 825] page: refcount:1 mapcount:0
mapping:0000000000000000 index:0x0 pfn:0x8b308b
[ 79.573710] [4: netbpfload: 825] memcg:c6ffff882d1d6402
[ 79.577791] [4: netbpfload: 825] flags:
0x6f80000000000000(zone=1|kasantag=0xbe)
[ 79.584042] [4: netbpfload: 825] raw: 6f80000000000000 0000000000000000
dead000000000122 0000000000000000
[ 79.592460] [4: netbpfload: 825] raw: 0000000000000000 0000000000000000
00000001ffffffff c6ffff882d1d6402
[ 79.600877] [4: netbpfload: 825] page dumped because: kasan: bad access
detected
[ 79.607126] [4: netbpfload: 825]
[ 79.609296] [4: netbpfload: 825] Memory state around the buggy address:
[ 79.614766] [4: netbpfload: 825] ffffffc08e637f00: 25 25 25 25 25 25
25 25 25 25 25 25 25 25 25 25
[ 79.622665] [4: netbpfload: 825] ffffffc08e638000: 25 25 25 25 25 25
25 25 25 25 25 25 25 25 25 25
[ 79.630562] [4: netbpfload: 825] >ffffffc08e638100: 25 25 25 25 25 25
25 fa fa fa fa fa fa fe fe fe
[ 79.638463] [4: netbpfload: 825]
^
[ 79.644190] [4: netbpfload: 825] ffffffc08e638200: fe fe fe fe fe fe
fe fe fe fe fe fe fe fe fe fe
[ 79.652089] [4: netbpfload: 825] ffffffc08e638300: fe fe fe fe fe fe
fe fe fe fe fe fe fe fe fe fe
[ 79.659987] [4: netbpfload: 825]
==================================================================
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are on the CC list for the bug.