Commit c3e8d5a
committed
Merge branch 'net-smc-two-fixes-for-smc-fallback'
Wen Gu says:
====================
net/smc: Two fixes for smc fallback
This patch set includes two fixes for smc fallback:
Patch 1/2 introduces some simple helpers to wrap the replacement
and restore of clcsock's callback functions. Make sure that only
the original callbacks will be saved and not overwritten.
Patch 2/2 fixes a syzbot reporting slab-out-of-bound issue where
smc_fback_error_report() accesses the already freed smc sock (see
https://lore.kernel.org/r/00000000000013ca8105d7ae3ada@google.com/).
The patch fixes it by resetting sk_user_data and restoring clcsock
callback functions timely in fallback situation.
But it should be noted that although patch 2/2 can fix the issue
of 'slab-out-of-bounds/use-after-free in smc_fback_error_report',
it can't pass the syzbot reproducer test. Because after applying
these two patches in upstream, syzbot reproducer triggered another
known issue like this:
==================================================================
BUG: KASAN: use-after-free in tcp_retransmit_timer+0x2ef3/0x3360 net/ipv4/tcp_timer.c:511
Read of size 8 at addr ffff888020328380 by task udevd/4158
CPU: 1 PID: 4158 Comm: udevd Not tainted 5.18.0-rc3-syzkaller-00074-gb05a5683eba6-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
print_address_description.constprop.0.cold+0xeb/0x467 mm/kasan/report.c:313
print_report mm/kasan/report.c:429 [inline]
kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491
tcp_retransmit_timer+0x2ef3/0x3360 net/ipv4/tcp_timer.c:511
tcp_write_timer_handler+0x5e6/0xbc0 net/ipv4/tcp_timer.c:622
tcp_write_timer+0xa2/0x2b0 net/ipv4/tcp_timer.c:642
call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1466 [inline]
__run_timers.part.0+0x679/0xa80 kernel/time/timer.c:1737
__run_timers kernel/time/timer.c:1715 [inline]
run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1750
__do_softirq+0x29b/0x9c2 kernel/softirq.c:558
invoke_softirq kernel/softirq.c:432 [inline]
__irq_exit_rcu+0x123/0x180 kernel/softirq.c:637
irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097
</IRQ>
...
(detail report can be found in https://syzkaller.appspot.com/text?tag=CrashReport&x=15406b44f00000)
IMHO, the above issue is the same as this known one: https://syzkaller.appspot.com/bug?extid=694120e1002c117747ed,
and it doesn't seem to be related with SMC. The discussion about this known issue is ongoing and can be found in
https://lore.kernel.org/bpf/000000000000f75af905d3ba0716@google.com/T/.
And I added the temporary solution mentioned in the above discussion on
top of my two patches, the syzbot reproducer of 'slab-out-of-bounds/
use-after-free in smc_fback_error_report' no longer triggers any issue.
====================
Link: https://lore.kernel.org/r/1650614179-11529-1-git-send-email-guwen@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>3 files changed
Lines changed: 126 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
246 | 261 | | |
247 | 262 | | |
248 | 263 | | |
249 | 264 | | |
250 | 265 | | |
| 266 | + | |
251 | 267 | | |
252 | 268 | | |
253 | 269 | | |
| |||
373 | 389 | | |
374 | 390 | | |
375 | 391 | | |
| 392 | + | |
376 | 393 | | |
377 | 394 | | |
378 | 395 | | |
| |||
744 | 761 | | |
745 | 762 | | |
746 | 763 | | |
747 | | - | |
748 | | - | |
| 764 | + | |
749 | 765 | | |
750 | | - | |
751 | | - | |
752 | | - | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
753 | 772 | | |
754 | 773 | | |
755 | 774 | | |
756 | 775 | | |
757 | | - | |
758 | | - | |
| 776 | + | |
759 | 777 | | |
760 | | - | |
761 | | - | |
762 | | - | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
763 | 784 | | |
764 | 785 | | |
765 | 786 | | |
766 | 787 | | |
767 | | - | |
768 | | - | |
| 788 | + | |
769 | 789 | | |
770 | | - | |
771 | | - | |
772 | | - | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
773 | 796 | | |
774 | 797 | | |
775 | 798 | | |
776 | 799 | | |
777 | | - | |
778 | | - | |
| 800 | + | |
779 | 801 | | |
780 | | - | |
781 | | - | |
782 | | - | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
783 | 827 | | |
784 | 828 | | |
785 | 829 | | |
786 | 830 | | |
787 | | - | |
788 | 831 | | |
789 | 832 | | |
790 | 833 | | |
791 | 834 | | |
792 | 835 | | |
793 | 836 | | |
794 | 837 | | |
795 | | - | |
796 | 838 | | |
797 | | - | |
798 | | - | |
799 | 839 | | |
800 | 840 | | |
801 | 841 | | |
| |||
810 | 850 | | |
811 | 851 | | |
812 | 852 | | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
| 853 | + | |
825 | 854 | | |
826 | 855 | | |
827 | 856 | | |
| |||
1596 | 1625 | | |
1597 | 1626 | | |
1598 | 1627 | | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
1599 | 1641 | | |
1600 | 1642 | | |
1601 | 1643 | | |
| |||
2355 | 2397 | | |
2356 | 2398 | | |
2357 | 2399 | | |
2358 | | - | |
2359 | | - | |
| 2400 | + | |
2360 | 2401 | | |
| 2402 | + | |
| 2403 | + | |
2361 | 2404 | | |
2362 | | - | |
| 2405 | + | |
2363 | 2406 | | |
2364 | 2407 | | |
2365 | 2408 | | |
2366 | 2409 | | |
2367 | 2410 | | |
2368 | 2411 | | |
| 2412 | + | |
| 2413 | + | |
2369 | 2414 | | |
2370 | 2415 | | |
2371 | 2416 | | |
| |||
2397 | 2442 | | |
2398 | 2443 | | |
2399 | 2444 | | |
2400 | | - | |
2401 | | - | |
| 2445 | + | |
2402 | 2446 | | |
2403 | 2447 | | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
2404 | 2451 | | |
2405 | 2452 | | |
2406 | 2453 | | |
| |||
2415 | 2462 | | |
2416 | 2463 | | |
2417 | 2464 | | |
2418 | | - | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
2419 | 2470 | | |
2420 | 2471 | | |
2421 | 2472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
291 | 299 | | |
292 | 300 | | |
293 | 301 | | |
294 | 302 | | |
295 | 303 | | |
296 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
297 | 326 | | |
298 | 327 | | |
299 | 328 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
218 | 220 | | |
| 221 | + | |
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
| |||
0 commit comments