Skip to content

driver/linux_onload: fix RCU usage#267

Open
ol-alexandra wants to merge 1 commit intoXilinx-CNS:masterfrom
ol-alexandra:master-debug-rcu
Open

driver/linux_onload: fix RCU usage#267
ol-alexandra wants to merge 1 commit intoXilinx-CNS:masterfrom
ol-alexandra:master-debug-rcu

Conversation

@ol-alexandra
Copy link
Copy Markdown
Contributor

Call rcu_read_lock() becore rcu_assign_pointer() in oo_fd_replace_file().

With this patch debug kernel stops from complaining on

[ 2863.017775] oo:ta_rpcs[34810]: Sharing Onload 4b6ff62  [0,sapi-ts]
[ 2863.030226] 
[ 2863.032853] =============================
[ 2863.037467] WARNING: suspicious RCU usage
[ 2863.042065] 6.8.12-1-debug-generic #2 Tainted: G           OE     
[ 2863.049105] -----------------------------
[ 2863.053686] /srv/testers/tmp/session_2024.11.21/balin_oo_i40e_6.8.12-1-debug-generic_x86_64_ndebug/src/driver/linux_onload/ossock_calls.c:126 suspicious rcu_dereference_check() usage!
[ 2863.072325] 
[ 2863.072325] other info that might help us debug this:
[ 2863.072325] 
[ 2863.086305] 
[ 2863.086305] rcu_scheduler_active = 2, debug_locks = 1
[ 2863.096900] 1 lock held by ta_rpcs/34810:
[ 2863.103073]  #0: ffff888146640e18 (&p->alloc_lock){+.+.}-{3:3}, at: oo_fd_replace_file+0x36/0x5f0 [onload]
[ 2863.115748] 
[ 2863.115748] stack backtrace:
[ 2863.123921] CPU: 0 PID: 34810 Comm: ta_rpcs Tainted: G           OE      6.8.12-1-debug-generic #2
[ 2863.135666] Hardware name: Dell Inc. PowerEdge R230/0FRVY0, BIOS 2.3.2 11/16/2017
[ 2863.145745] Call Trace:
[ 2863.150112]  <TASK>
[ 2863.154068]  dump_stack_lvl+0xeb/0x100
[ 2863.159889]  dump_stack+0x10/0x20
[ 2863.165180]  lockdep_rcu_suspicious+0x21e/0x410
[ 2863.171835]  oo_fd_replace_file+0x52f/0x5f0 [onload]
[ 2863.178982]  efab_tcp_helper_handover+0x5ec/0xb00 [onload]
[ 2863.186696]  ? __pfx_lock_release+0x10/0x10
[ 2863.193336]  ? __pfx_efab_tcp_helper_handover+0x10/0x10 [onload]
[ 2863.201639]  ? __might_fault+0xd9/0x1a0
[ 2863.207459]  oo_fop_unlocked_ioctl+0x1bf/0x470 [onload]
[ 2863.214861]  ? __pfx_oo_fop_unlocked_ioctl+0x10/0x10 [onload]
[ 2863.222844]  ? debug_smp_processor_id+0x17/0x30
[ 2863.229423]  ? do_syscall_64+0xa1/0x190
[ 2863.235212]  ? __kasan_check_read+0x11/0x20
[ 2863.241356]  ? __fget_light+0x59/0x200
[ 2863.247003]  __x64_sys_ioctl+0x140/0x1c0
[ 2863.252848]  x64_sys_call+0x1395/0x2660
[ 2863.258573]  do_syscall_64+0x95/0x190
[ 2863.264094]  ? irqentry_exit+0x77/0xb0
[ 2863.269697]  ? exc_page_fault+0x92/0x140
[ 2863.275464]  entry_SYSCALL_64_after_hwframe+0x78/0x80
[ 2863.282468] RIP: 0033:0x77b715f1a94f
[ 2863.287790] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <41> 89 c0 3d 00 f0 ff ff 77 1f 48 8b 44 24 18 64 48 2b 04 25 28 00
[ 2863.311685] RSP: 002b:00007ffd1001abf0 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 2863.321608] RAX: ffffffffffffffda RBX: 000077b71602d0c8 RCX: 000077b715f1a94f
[ 2863.331034] RDX: 00007ffd1001ac54 RSI: 00000000c0045a39 RDI: 0000000000000006
[ 2863.340476] RBP: 0000000000000006 R08: 000056521de76320 R09: 000077b7137ff000
[ 2863.349941] R10: 000000005101c0fe R11: 0000000000000246 R12: 00000000c0045a39
[ 2863.359402] R13: 000077b715dff4e0 R14: 0000000000000000 R15: 000056521de6a8b0

Call rcu_read_lock() becore rcu_assign_pointer() in
oo_fd_replace_file().

OL-Redmine-Id: 14015
Signed-off-by: Alexandra Kossovsky <alexandra.kossovsky@oktetlabs.ru>
@ol-alexandra ol-alexandra requested a review from a team as a code owner February 27, 2025 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant