-
Notifications
You must be signed in to change notification settings - Fork 12
[CBR 7.9] CVE-2023-1281 #401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
jira VULN-7633 cve-pre CVE-2023-1281 commit-author Paul E. McKenney <[email protected]> commit a63fc6b Although the rcu_swap_protected() macro follows the example of swap(), the interactions with RCU make its update of its argument somewhat counter-intuitive. This commit therefore introduces an rcu_replace_pointer() that returns the old value of the RCU pointer instead of doing the argument update. Once all the uses of rcu_swap_protected() are updated to instead use rcu_replace_pointer(), rcu_swap_protected() will be removed. Link: https://lore.kernel.org/lkml/CAHk-=wiAsJLw1egFEE=Z7-GGtM6wcvtyytXZA1+BHqta4gg6Hw@mail.gmail.com/ Reported-by: Linus Torvalds <[email protected]> [ paulmck: From rcu_replace() to rcu_replace_pointer() per Ingo Molnar. ] Signed-off-by: Paul E. McKenney <[email protected]> Cc: Bart Van Assche <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Johannes Thumshirn <[email protected]> Cc: Shane M Seymour <[email protected]> Cc: Martin K. Petersen <[email protected]> (cherry picked from commit a63fc6b) Signed-off-by: Marcin Wcisło <[email protected]>
jira VULN-7633 cve CVE-2023-1281 commit-author Pedro Tammela <[email protected]> commit ee05917 The imperfect hash area can be updated while packets are traversing, which will cause a use-after-free when 'tcf_exts_exec()' is called with the destroyed tcf_ext. CPU 0: CPU 1: tcindex_set_parms tcindex_classify tcindex_lookup tcindex_lookup tcf_exts_change tcf_exts_exec [UAF] Stop operating on the shared area directly, by using a local copy, and update the filter with 'rcu_replace_pointer()'. Delete the old filter version only after a rcu grace period elapsed. Fixes: 9b0d444 ("net: sched: avoid atomic swap in tcf_exts_change") Reported-by: valis <[email protected]> Suggested-by: valis <[email protected]> Signed-off-by: Jamal Hadi Salim <[email protected]> Signed-off-by: Pedro Tammela <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> (cherry picked from commit ee05917) Signed-off-by: Marcin Wcisło <[email protected]>
jira VULN-7633 cve CVE-2023-1281 commit-author Pedro Tammela <[email protected]> commit 42018a3 Syzkaller found an issue where a handle greater than 16 bits would trigger a null-ptr-deref in the imperfect hash area update. general protection fault, probably for non-canonical address 0xdffffc0000000015: 0000 [ctrliq#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x00000000000000a8-0x00000000000000af] CPU: 0 PID: 5070 Comm: syz-executor456 Not tainted 6.2.0-rc7-syzkaller-00112-gc68f345b7c42 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023 RIP: 0010:tcindex_set_parms+0x1a6a/0x2990 net/sched/cls_tcindex.c:509 Code: 01 e9 e9 fe ff ff 4c 8b bd 28 fe ff ff e8 0e 57 7d f9 48 8d bb a8 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 94 0c 00 00 48 8b 85 f8 fd ff ff 48 8b 9b a8 00 RSP: 0018:ffffc90003d3ef88 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000000015 RSI: ffffffff8803a102 RDI: 00000000000000a8 RBP: ffffc90003d3f1d8 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffff88801e2b10a8 R13: dffffc0000000000 R14: 0000000000030000 R15: ffff888017b3be00 FS: 00005555569af300(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000056041c6d2000 CR3: 000000002bfca000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> tcindex_change+0x1ea/0x320 net/sched/cls_tcindex.c:572 tc_new_tfilter+0x96e/0x2220 net/sched/cls_api.c:2155 rtnetlink_rcv_msg+0x959/0xca0 net/core/rtnetlink.c:6132 netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2574 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1365 netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1942 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 ____sys_sendmsg+0x334/0x8c0 net/socket.c:2476 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2530 __sys_sendmmsg+0x18f/0x460 net/socket.c:2616 __do_sys_sendmmsg net/socket.c:2645 [inline] __se_sys_sendmmsg net/socket.c:2642 [inline] __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2642 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 Fixes: ee05917 ("net/sched: tcindex: update imperfect hash filters respecting rcu") Signed-off-by: Jamal Hadi Salim <[email protected]> Signed-off-by: Pedro Tammela <[email protected]> Reported-by: syzbot <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]> (cherry picked from commit 42018a3) Signed-off-by: Marcin Wcisło <[email protected]>
Btw, the |
I can send it over but RHEL is
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚤
[CBR 7.9]
CVE-2023-1281
VULN-7633
Problem
https://nvd.nist.gov/vuln/detail/CVE-2023-1281
Applicability: yes
The
CONFIG_NET_CLS_TCINDEX
option including the affected filenet/sched/cls_tcindex.c
in the build is enabled inconfigs/kernel-3.10.0-x86_64.config
kernel-src-tree/configs/kernel-3.10.0-x86_64.config
Line 1360 in ba92bd2
The
tcindex_set_parms
function clearly doesn't contain the rcu-related code from the fix ee05917:kernel-src-tree/net/sched/cls_tcindex.c
Lines 430 to 433 in ba92bd2
kernel-src-tree/net/sched/cls_tcindex.c
Lines 467 to 481 in ba92bd2
Solution
The mainline fix ee05917 makes use of
rcu_replace_pointer
macro from the Read-Copy-Update synchronization system, fileinclude/linux/rcupdate.h
, which is missing from CBR 7.9. It was introduced in a63fc6b and backported as part of this patch.The ee05917 fix was also imperfect and a fix-of-the fix appeared in 42018a3. It was also included as part of this patch.
The solution therefore consists of backported 3 mainline commits:
No differences relative to the mainline changes are present in the backports.
kABI check: passed
Boot test: passed
boot-test.log
Kselftests
Reference
kselftests–ciqcbr7_9–run1.log
kselftests–ciqcbr7_9–run2.log
kselftests–ciqcbr7_9–run3.log
Patch
kselftests–ciqcbr7_9-CVE-2023-1281–run1.log
kselftests–ciqcbr7_9-CVE-2023-1281–run2.log
kselftests–ciqcbr7_9-CVE-2023-1281–run3.log
Specific tests: passed
Given lack of nearly any selftests for networking in CBR 7.9 some tests relating specifically to the
tcindex
module were carried out. They do not precisely capture the bug, therefore there is no "before and after" comparison with a clearly visible improvemnt; rather a sanity check of the module was done on the patched kernel to prove the proper working of its basic functionality.The test consists of setting up a dsmark qdisc using some tcindex filters, then generating some traffic with
iperf3
and thus confirming that the kernel didn't crash and the network remained functional. The setup is taken from https://lartc.org/lartc.html. (An attempt was made to modify the setup in a controlled manner such that the proper working oftcindex
filter could be shown but it failed due to nearly no documentation oftcindex
available (the tcindex(8) manpage is a joke) and similar lack of examples on the internet of this obscure feature.)Reference bandwidth between the hypervisor and the virtual host measurement. The IPs are
192.168.122.1
for the hypervisor and192.168.122.224
for the virtual host.Virtual machine:
Hypervisor
The bandwidth is huge, which is to be expected given that there is no actual physical link involved.
tc
setupDisplay the classes statistics for control
Run
iperf3
againThe network is functional.
Display the classes statistics on the VM again
All traffic was handled by the cbq class
2:
.