Skip to content
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

[syzkaller] WARNING in mptcp_reset_timer #126

Closed
cpaasch opened this issue Dec 10, 2020 · 10 comments
Closed

[syzkaller] WARNING in mptcp_reset_timer #126

cpaasch opened this issue Dec 10, 2020 · 10 comments
Assignees

Comments

@cpaasch
Copy link
Member

cpaasch commented Dec 10, 2020

------------[ cut here ]------------
WARNING: CPU: 1 PID: 12512 at net/mptcp/protocol.c:761 mptcp_reset_timer+0x12a/0x160 net/mptcp/protocol.c:761
Modules linked in:
CPU: 1 PID: 12512 Comm: kworker/1:6 Not tainted 5.10.0-rc6 #52
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
Workqueue: events mptcp_worker
RIP: 0010:mptcp_reset_timer+0x12a/0x160 net/mptcp/protocol.c:761
Code: e8 4b 0c ad ff e8 56 21 88 fe 48 b8 00 00 00 00 00 fc ff df 48 c7 04 03 00 00 00 00 48 83 c4 40 5b 5d 41 5c c3 e8 36 21 88 fe <0f> 0b 41 bc c8 00 00 00 eb 98 e8 e7 b1 af fe e9 30 ff ff ff 48 c7
RSP: 0018:ffffc900018c7c68 EFLAGS: 00010293
RAX: ffff888108cb1c80 RBX: 1ffff92000318f8d RCX: ffffffff82ad0307
RDX: 0000000000000000 RSI: ffffffff82ad036a RDI: 0000000000000007
RBP: ffff888113e2d000 R08: ffff888108cb1c80 R09: ffffed10227c5ab7
R10: ffff888113e2d5b7 R11: ffffed10227c5ab6 R12: 0000000000000000
R13: ffff88801f100000 R14: ffff888113e2d5b0 R15: 0000000000000001
FS:  0000000000000000(0000) GS:ffff88811b500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd76a874ef8 CR3: 000000001689c005 CR4: 0000000000170ee0
Call Trace:
 mptcp_worker+0xaa4/0x1560 net/mptcp/protocol.c:2334
 process_one_work+0x8d3/0x1200 kernel/workqueue.c:2272
 worker_thread+0x9c/0x1090 kernel/workqueue.c:2418
 kthread+0x303/0x410 kernel/kthread.c:292
 ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:296

HEAD:
05cb27b ("DO-NOT-MERGE: mptcp: enabled by default") (HEAD, tag: export/20201209T060936, mptcp_net-next/export) (12 hours ago)
525593c ("DO-NOT-MERGE: mptcp: add GitHub Actions") (12 hours ago)
6aa8731 ("DO-NOT-MERGE: mptcp: use kmalloc on kasan build") (12 hours ago)
2227bfd ("mptcp: let MPTCP create max size skbs") (12 hours ago)
908c632 ("mptcp: pm: simplify select_local_address()") (12 hours ago)
a771b76 ("mptcp: parse and act on incoming FASTCLOSE option") (12 hours ago)
7dbc6b7 ("tcp: parse mptcp options contained in reset packets") (12 hours ago)
4598a67 ("mptcp: hold mptcp socket before calling tcp_done") (12 hours ago)
3630500 ("mptcp: use MPTCPOPT_HMAC_LEN macro") (12 hours ago)
905c00c ("selftests: mptcp: add the flush addrs testcase") (12 hours ago)
2d0de9b ("mptcp: remove address when netlink flushes addrs") (12 hours ago)
389cb8d ("mptcp: use the variable sk instead of open-coding") (12 hours ago)
62ad6da ("mptcp: rename add_addr_signal and mptcp_add_addr_status") (12 hours ago)
56607a9 ("mptcp: drop rm_addr_signal flag") (12 hours ago)
f561498 ("mptcp: print out port and ahmac when receiving ADD_ADDR") (12 hours ago)
faec918 ("mptcp: add port parameter for mptcp_pm_announce_addr") (12 hours ago)
1bab32f ("mptcp: send out dedicated packet for ADD_ADDR using port") (12 hours ago)
a7429bb ("mptcp: add the outgoing ADD_ADDR port support") (12 hours ago)
a8787a8 ("mptcp: use adding up size to get ADD_ADDR length") (12 hours ago)
1690597 ("mptcp: add port support for ADD_ADDR suboption writing") (12 hours ago)
4021cd8 ("mptcp: unify ADD_ADDR and ADD_ADDR6 suboptions writing") (12 hours ago)
0b86309 ("mptcp: unify ADD_ADDR and echo suboptions writing") (12 hours ago)
c855f89 ("bpf:selftests: add bpf_mptcp_sock() verifier tests") (12 hours ago)
0eaea54 ("bpf:selftests: add MPTCP test base") (12 hours ago)
eed59ab ("bpf: add 'bpf_mptcp_sock' structure and helper") (12 hours ago)
6dd1da9 ("mptcp: attach subflow socket to parent cgroup") (12 hours ago)
58a4d0c ("bpf: expose is_mptcp flag to bpf_tcp_sock") (12 hours ago)
d188dfe ("mptcp: be careful on subflows shutdown") (12 hours ago)
9910201 ("mptcp: plug subflow context memory leak") (12 hours ago)
ae1cd5e ("mptcp: link MPC subflow into msk only after accept") (12 hours ago)
afae3cc ("net: atheros: simplify the return expression of atl2_phy_setup_autoneg_adv()") (mptcp_net-next/net-next) (18 hours ago)

No reproducer.

CONFIG-file:
CONFIG.txt

@matttbe
Copy link
Member

matttbe commented Dec 10, 2020

might be linked to #105 (still happening) and #70

@dcaratti
Copy link
Contributor

ATM the syz repro is causing a splat similar to the one in issue #115 , will fix this first

@pabeni
Copy link

pabeni commented Jan 14, 2021

@cpaasch: on current export branch this one should at least trigger a different back-trace and possibly could be fixed, could you still reproduce it?

@cpaasch
Copy link
Member Author

cpaasch commented Jan 14, 2021

Not happening right now. If I see it again, I will update you here.

@matttbe
Copy link
Member

matttbe commented Jan 15, 2021

Thx for having tested!

I suggest to close this ticket, feel free to re-open it if needed.

@matttbe matttbe closed this as completed Jan 15, 2021
@cpaasch cpaasch reopened this Jan 28, 2021
@cpaasch
Copy link
Member Author

cpaasch commented Jan 28, 2021

Reopening...

HEAD is at:
b4875a2a7e4a ("some more debugging in sk_stream_kill_queues") (HEAD) (67 minutes ago)
7085653 ("DO-NOT-MERGE: mptcp: enabled by default") (tag: export/20210128T064336, mptcp_net-next/export) (12 hours ago)
a475850 ("DO-NOT-MERGE: mptcp: add GitHub Actions") (12 hours ago)
489c73c ("DO-NOT-MERGE: mptcp: use kmalloc on kasan build") (12 hours ago)
3519fa3 ("mptcp: add netlink event support") (12 hours ago)
6db4b06 ("genetlink: add CAP_NET_ADMIN test for multicast bind") (12 hours ago)
6c95082 ("mptcp: avoid lock_fast usage in accept path") (12 hours ago)
5c072ef ("mptcp: pass subflow socket to a few helpers") (12 hours ago)
2709acb ("mptcp: split __mptcp_close_ssk helper") (12 hours ago)
ad95403 ("mptcp: move pm netlink work into pm_netlink") (12 hours ago)
b77a832 ("mptcp: pm: add lockdep assertions") (12 hours ago)
3d2aa90 ("selftests: mptcp: add command line arguments for mptcp_join.sh") (12 hours ago)
3105f3e ("selftests: mptcp: add testcases for ADD_ADDR with port") (12 hours ago)
53118be ("mptcp: add the mibs for ADD_ADDR with port") (12 hours ago)
fe8cb87 ("selftests: mptcp: add port argument for pm_nl_ctl") (12 hours ago)
e5190ee ("mptcp: deal with MPTCP_PM_ADDR_ATTR_PORT in PM netlink") (12 hours ago)
6322ac0 ("mptcp: enable use_port when invoke addresses_equal") (12 hours ago)
631325c ("mptcp: add port number check for MP_JOIN") (12 hours ago)
c06d086 ("mptcp: add a new helper subflow_req_create_thmac") (12 hours ago)
99be957 ("mptcp: drop unused skb in subflow_token_join_request") (12 hours ago)
12a982e ("mptcp: create the listening socket for new port") (12 hours ago)
9147162 ("selftests: mptcp: add testcases for newly added addresses") (12 hours ago)
4010c2d ("selftests: mptcp: use minus values for removing address numbers") (12 hours ago)
ff8b502 ("mptcp: send ack for every add_addr") (12 hours ago)
cc6454e ("mptcp: create subflow or signal addr for newly added address") (12 hours ago)
b37ae55 ("mptcp: drop *_max fields in mptcp_pm_data") (12 hours ago)
8aa9be3 ("mptcp: use WRITE_ONCE/READ_ONCE for the pernet *_max") (12 hours ago)
cae4ced ("bpf:selftests: add bpf_mptcp_sock() verifier tests") (12 hours ago)
7bd6ee3 ("bpf:selftests: add MPTCP test base") (12 hours ago)
d36880e ("bpf: add 'bpf_mptcp_sock' structure and helper") (12 hours ago)
710910e ("bpf: expose is_mptcp flag to bpf_tcp_sock") (12 hours ago)
75a7ca5 ("linux: handle MPTCP consistently with TCP") (12 hours ago)
d1f3bdd ("net: dsa: rtl8366rb: standardize init jam tables") (mptcp_net-next/net-next) (14 hours ago)

RBP: 0000000000000102 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000069bf6c
R13: 00007ffdd8439abf R14: 00007f4aa5ea3000 R15: 0000000000000003
------------[ cut here ]------------
WARNING: CPU: 1 PID: 10368 at net/mptcp/protocol.c:764 mptcp_reset_timer+0x12a/0x160 net/mptcp/protocol.c:764
Modules linked in:
CPU: 1 PID: 10368 Comm: kworker/1:2 Not tainted 5.11.0-rc4b4875a2a7e4a3a770cb007c5a294bdb7a647adf0 #66
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
Workqueue: events mptcp_worker
RIP: 0010:mptcp_reset_timer+0x12a/0x160 net/mptcp/protocol.c:764
Code: e8 7b 2b ac ff e8 a6 2e 83 fe 48 b8 00 00 00 00 00 fc ff df 48 c7 04 03 00 00 00 00 48 83 c4 40 5b 5d 41 5c c3 e8 86 2e 83 fe <0f> 0b 41 bc c8 00 00 00 eb 98 e8 27 fc aa fe e9 30 ff ff ff 48 c7
RSP: 0018:ffffc90003b1fc60 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 1ffff92000763f8c RCX: 0000000000000000
RDX: ffff888030f6c9c0 RSI: ffffffff82b2bf5a RDI: 0000000000000003
RBP: ffff8880136f7000 R08: 0000000000000000 R09: 0000000000000001
R10: ffffffff82b2bef7 R11: 0000000000000007 R12: 0000000000000000
R13: ffff8880136f75b8 R14: ffff888015970000 R15: 0000000000000001
FS:  0000000000000000(0000) GS:ffff88811b500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffddac74c4c CR3: 000000010a73c006 CR4: 0000000000170ee0
Call Trace:
 mptcp_worker+0xe47/0x1310 net/mptcp/protocol.c:2307
 process_one_work+0x896/0x1170 kernel/workqueue.c:2275
 worker_thread+0x605/0x1350 kernel/workqueue.c:2421
 kthread+0x344/0x410 kernel/kthread.c:292
 ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:296

CONFIG-file:
CONFIG.txt

@cpaasch
Copy link
Member Author

cpaasch commented Jan 28, 2021

Actually - no ! This is the same as sk_stream_kill_queues...

@cpaasch cpaasch closed this as completed Jan 28, 2021
@cpaasch
Copy link
Member Author

cpaasch commented Feb 1, 2021

Reopening - it is still happening, even after I apply Eric's patch.

------------[ cut here ]------------
WARNING: CPU: 0 PID: 22534 at net/mptcp/protocol.c:764 mptcp_reset_timer+0x12a/0x160 net/mptcp/protocol.c:764
Modules linked in:
CPU: 0 PID: 22534 Comm: kworker/0:1 Not tainted 5.11.0-rc4e667aa91249d564c5b47a4302002dd8876ea201d #67
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
Workqueue: events mptcp_worker
RIP: 0010:mptcp_reset_timer+0x12a/0x160 net/mptcp/protocol.c:764
Code: e8 1b 2b ac ff e8 46 2e 83 fe 48 b8 00 00 00 00 00 fc ff df 48 c7 04 03 00 00 00 00 48 83 c4 40 5b 5d 41 5c c3 e8 26 2e 83 fe <0f> 0b 41 bc c8 00 00 00 eb 98 e8 c7 fb aa fe e9 30 ff ff ff 48 c7
RSP: 0018:ffffc9000050fc60 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 1ffff920000a1f8c RCX: 0000000000000000
RDX: ffff88800fe58000 RSI: ffffffff82b2bfba RDI: 0000000000000003
RBP: ffff888034916000 R08: 0000000000000000 R09: 0000000000000004
R10: ffffffff82b2bf57 R11: 0000000000000007 R12: 0000000000000000
R13: ffff8880349165b8 R14: ffff88800fc88000 R15: 0000000000000004
FS:  0000000000000000(0000) GS:ffff88811b400000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 00000000179e9002 CR4: 0000000000170ef0
Call Trace:
 mptcp_worker+0xe47/0x1310 net/mptcp/protocol.c:2307
 process_one_work+0x896/0x1170 kernel/workqueue.c:2275
 worker_thread+0x605/0x1350 kernel/workqueue.c:2421
 kthread+0x344/0x410 kernel/kthread.c:292
 ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:296

e667aa91249d ("Eric's fix") (HEAD) (4 days ago)
b4875a2a7e4a ("some more debugging in sk_stream_kill_queues") (4 days ago)
7085653 ("DO-NOT-MERGE: mptcp: enabled by default") (tag: export/20210128T064336, mptcp_net-next/export) (4 days ago)
a475850 ("DO-NOT-MERGE: mptcp: add GitHub Actions") (4 days ago)
489c73c ("DO-NOT-MERGE: mptcp: use kmalloc on kasan build") (4 days ago)
3519fa3 ("mptcp: add netlink event support") (4 days ago)
6db4b06 ("genetlink: add CAP_NET_ADMIN test for multicast bind") (4 days ago)
6c95082 ("mptcp: avoid lock_fast usage in accept path") (4 days ago)
5c072ef ("mptcp: pass subflow socket to a few helpers") (4 days ago)
2709acb ("mptcp: split __mptcp_close_ssk helper") (4 days ago)
ad95403 ("mptcp: move pm netlink work into pm_netlink") (4 days ago)
b77a832 ("mptcp: pm: add lockdep assertions") (4 days ago)
3d2aa90 ("selftests: mptcp: add command line arguments for mptcp_join.sh") (4 days ago)
3105f3e ("selftests: mptcp: add testcases for ADD_ADDR with port") (4 days ago)
53118be ("mptcp: add the mibs for ADD_ADDR with port") (4 days ago)
fe8cb87 ("selftests: mptcp: add port argument for pm_nl_ctl") (4 days ago)
e5190ee ("mptcp: deal with MPTCP_PM_ADDR_ATTR_PORT in PM netlink") (4 days ago)
6322ac0 ("mptcp: enable use_port when invoke addresses_equal") (4 days ago)
631325c ("mptcp: add port number check for MP_JOIN") (4 days ago)
c06d086 ("mptcp: add a new helper subflow_req_create_thmac") (4 days ago)
99be957 ("mptcp: drop unused skb in subflow_token_join_request") (4 days ago)
12a982e ("mptcp: create the listening socket for new port") (4 days ago)
9147162 ("selftests: mptcp: add testcases for newly added addresses") (4 days ago)
4010c2d ("selftests: mptcp: use minus values for removing address numbers") (4 days ago)
ff8b502 ("mptcp: send ack for every add_addr") (4 days ago)
cc6454e ("mptcp: create subflow or signal addr for newly added address") (4 days ago)
b37ae55 ("mptcp: drop *_max fields in mptcp_pm_data") (4 days ago)
8aa9be3 ("mptcp: use WRITE_ONCE/READ_ONCE for the pernet *_max") (4 days ago)
cae4ced ("bpf:selftests: add bpf_mptcp_sock() verifier tests") (4 days ago)
7bd6ee3 ("bpf:selftests: add MPTCP test base") (4 days ago)
d36880e ("bpf: add 'bpf_mptcp_sock' structure and helper") (4 days ago)
710910e ("bpf: expose is_mptcp flag to bpf_tcp_sock") (4 days ago)
75a7ca5 ("linux: handle MPTCP consistently with TCP") (4 days ago)
d1f3bdd ("net: dsa: rtl8366rb: standardize init jam tables") (mptcp_net-next/net-next) (5 days ago)

CONFIG-file:
CONFIG.txt

@cpaasch cpaasch reopened this Feb 1, 2021
@cpaasch
Copy link
Member Author

cpaasch commented Feb 3, 2021

Still happening on:

d82d76887ec6 ("mptcp: fix spurious retransmissions") (HEAD) (8 hours ago)
9c23f272d8c2 ("Eric's fix") (8 hours ago)
e2fe949 ("DO-NOT-MERGE: mptcp: enabled by default") (tag: export/20210202T061758, mptcp_net-next/export) (18 hours ago)
13b4d63 ("DO-NOT-MERGE: mptcp: add GitHub Actions") (18 hours ago)
c2c6844 ("DO-NOT-MERGE: mptcp: use kmalloc on kasan build") (18 hours ago)
6399d64 ("mptcp: add netlink event support") (18 hours ago)
cf6cac4 ("genetlink: add CAP_NET_ADMIN test for multicast bind") (18 hours ago)
875cda9 ("mptcp: avoid lock_fast usage in accept path") (18 hours ago)
d30f162 ("mptcp: pass subflow socket to a few helpers") (18 hours ago)
5ee34d5 ("mptcp: split __mptcp_close_ssk helper") (18 hours ago)
fbc8817 ("mptcp: move pm netlink work into pm_netlink") (18 hours ago)
77a274c ("mptcp: pm: add lockdep assertions") (18 hours ago)
e75bbfc ("selftests: mptcp: add command line arguments for mptcp_join.sh") (18 hours ago)
7b74dee ("selftests: mptcp: add testcases for ADD_ADDR with port") (18 hours ago)
7dad582 ("mptcp: add the mibs for ADD_ADDR with port") (18 hours ago)
fc67ce1 ("selftests: mptcp: add port argument for pm_nl_ctl") (18 hours ago)
4864e76 ("mptcp: deal with MPTCP_PM_ADDR_ATTR_PORT in PM netlink") (18 hours ago)
b99b4c0 ("mptcp: enable use_port when invoke addresses_equal") (18 hours ago)
6f9d0f9 ("mptcp: add port number check for MP_JOIN") (18 hours ago)
6f2398c ("mptcp: add a new helper subflow_req_create_thmac") (18 hours ago)
28985de ("mptcp: drop unused skb in subflow_token_join_request") (18 hours ago)
47c71c6 ("mptcp: create the listening socket for new port") (18 hours ago)
b8a22e0 ("selftests: mptcp: add testcases for newly added addresses") (18 hours ago)
5978f84 ("selftests: mptcp: use minus values for removing address numbers") (18 hours ago)
b8cda5a ("mptcp: send ack for every add_addr") (18 hours ago)
8333d08 ("mptcp: create subflow or signal addr for newly added address") (18 hours ago)
1031d4b ("mptcp: drop *_max fields in mptcp_pm_data") (18 hours ago)
bb2d333 ("mptcp: use WRITE_ONCE/READ_ONCE for the pernet *_max") (18 hours ago)
e2868c0 ("bpf:selftests: add bpf_mptcp_sock() verifier tests") (18 hours ago)
c681345 ("bpf:selftests: add MPTCP test base") (18 hours ago)
0bb29bf ("bpf: add 'bpf_mptcp_sock' structure and helper") (18 hours ago)
bc464f0 ("bpf: expose is_mptcp flag to bpf_tcp_sock") (18 hours ago)
d4a677f ("linux: handle MPTCP consistently with TCP") (18 hours ago)
2c87774 ("mptcp: fix length of MP_PRIO suboption") (18 hours ago)
9ae4bdc ("Merge branch 'rework-the-memory-barrier-for-scrq-entry'") (mptcp_net-next/net-next) (20 hours ago)

CONFIG:
CONFIG.txt

@matttbe
Copy link
Member

matttbe commented Feb 8, 2021

Should be fixed thanks to a new patch from Paolo: f880cae: mptcp: fix spurious retransmissions

@matttbe matttbe closed this as completed Feb 8, 2021
jenkins-tessares pushed a commit that referenced this issue Nov 18, 2021
When SUSPEND_DISCONNECTING bit is set that means Disconnect is pending
but the code was evaluating if the list is empty before calling
hci_conn_del which does the actual cleanup and remove the connection
from the list thus the bit is never cleared causing the suspend
procedure to always timeout when there are connections to be
disconnected:

Suspend/Resume - Success 5 (Pairing - Legacy) - waiting done
  Set the system into Suspend via force_suspend
= mgmt-tester: Suspend/Resume - Success 5 (Pairing -..   17:03:13.200458
= mgmt-tester: Set the system into Suspend via force_suspend    17:03:13.205812
< HCI Command: Write Scan E.. (0x03|0x001a) plen 1  #122 [hci0] 17:03:13.213561
        Scan enable: No Scans (0x00)
> HCI Event: Command Complete (0x0e) plen 4         #123 [hci0] 17:03:13.214710
      Write Scan Enable (0x03|0x001a) ncmd 1
        Status: Success (0x00)
< HCI Command: Disconnect (0x01|0x0006) plen 3      #124 [hci0] 17:03:13.215830
        Handle: 42
        Reason: Remote Device Terminated due to Power Off (0x15)
> HCI Event: Command Status (0x0f) plen 4           #125 [hci0] 17:03:13.216602
      Disconnect (0x01|0x0006) ncmd 1
        Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4      #126 [hci0] 17:03:13.217342
        Status: Success (0x00)
        Handle: 42
        Reason: Remote Device Terminated due to Power Off (0x15)
@ MGMT Event: Device Disconn.. (0x000c) plen 8  {0x0002} [hci0] 17:03:13.217688
        BR/EDR Address: 00:AA:01:01:00:00 (Intel Corporation)
        Reason: Connection terminated by local host for suspend (0x05)
@ MGMT Event: Device Disconn.. (0x000c) plen 8  {0x0001} [hci0] 17:03:13.217688
        BR/EDR Address: 00:AA:01:01:00:00 (Intel Corporation)
        Reason: Connection terminated by local host for suspend (0x05)
Suspend/Resume - Success 5 (Pairing - Legacy) - test timed out
= mgmt-tester: Suspend/Resume - Success 5 (Pairing -..   17:03:13.939317
Suspend/Resume - Success 5 (Pairing - Legacy) - teardown
= mgmt-tester: Suspend/Resume - Success 5 (Pairing -..   17:03:13.947267
[   13.284291] Bluetooth: hci0: Timed out waiting for suspend events
[   13.287324] Bluetooth: hci0: Suspend timeout bit: 6

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
jenkins-tessares pushed a commit that referenced this issue Nov 30, 2022
Commit b140513 ("mm/sl[au]b: generalize kmalloc subsystem")
refactored large parts of the kmalloc subsystem, resulting in the stack
trace pruning logic done by KFENCE to no longer work.

While b140513 attempted to fix the situation by including
'__kmem_cache_free' in the list of functions KFENCE should skip through,
this only works when the compiler actually optimized the tail call from
kfree() to __kmem_cache_free() into a jump (and thus kfree() _not_
appearing in the full stack trace to begin with).

In some configurations, the compiler no longer optimizes the tail call
into a jump, and __kmem_cache_free() appears in the stack trace.  This
means that the pruned stack trace shown by KFENCE would include kfree()
which is not intended - for example:

 | BUG: KFENCE: invalid free in kfree+0x7c/0x120
 |
 | Invalid free of 0xffff8883ed8fefe0 (in kfence-#126):
 |  kfree+0x7c/0x120
 |  test_double_free+0x116/0x1a9
 |  kunit_try_run_case+0x90/0xd0
 | [...]

Fix it by moving __kmem_cache_free() to the list of functions that may be
tail called by an allocator entry function, making the pruning logic work
in both the optimized and unoptimized tail call cases.

Link: https://lkml.kernel.org/r/20221118152216.3914899-1-elver@google.com
Fixes: b140513 ("mm/sl[au]b: generalize kmalloc subsystem")
Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Feng Tang <feng.tang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
matttbe pushed a commit that referenced this issue Jan 26, 2024
Like commit 1cf3bfc ("bpf: Support 64-bit pointers to kfuncs")
for s390x, add support for 64-bit pointers to kfuncs for LoongArch.
Since the infrastructure is already implemented in BPF core, the only
thing need to be done is to override bpf_jit_supports_far_kfunc_call().

Before this change, several test_verifier tests failed:

  # ./test_verifier | grep # | grep FAIL
  #119/p calls: invalid kfunc call: ptr_to_mem to struct with non-scalar FAIL
  #120/p calls: invalid kfunc call: ptr_to_mem to struct with nesting depth > 4 FAIL
  #121/p calls: invalid kfunc call: ptr_to_mem to struct with FAM FAIL
  #122/p calls: invalid kfunc call: reg->type != PTR_TO_CTX FAIL
  #123/p calls: invalid kfunc call: void * not allowed in func proto without mem size arg FAIL
  #124/p calls: trigger reg2btf_ids[reg->type] for reg->type > __BPF_REG_TYPE_MAX FAIL
  #125/p calls: invalid kfunc call: reg->off must be zero when passed to release kfunc FAIL
  #126/p calls: invalid kfunc call: don't match first member type when passed to release kfunc FAIL
  #127/p calls: invalid kfunc call: PTR_TO_BTF_ID with negative offset FAIL
  #128/p calls: invalid kfunc call: PTR_TO_BTF_ID with variable offset FAIL
  #129/p calls: invalid kfunc call: referenced arg needs refcounted PTR_TO_BTF_ID FAIL
  #130/p calls: valid kfunc call: referenced arg needs refcounted PTR_TO_BTF_ID FAIL
  #486/p map_kptr: ref: reference state created and released on xchg FAIL

This is because the kfuncs in the loaded module are far away from
__bpf_call_base:

  ffff800002009440 t bpf_kfunc_call_test_fail1    [bpf_testmod]
  9000000002e128d8 T __bpf_call_base

The offset relative to __bpf_call_base does NOT fit in s32, which breaks
the assumption in BPF core. Enable bpf_jit_supports_far_kfunc_call() lifts
this limit.

Note that to reproduce the above result, tools/testing/selftests/bpf/config
should be applied, and run the test with JIT enabled, unpriv BPF enabled.

With this change, the test_verifier tests now all passed:

  # ./test_verifier
  ...
  Summary: 777 PASSED, 0 SKIPPED, 0 FAILED

Tested-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants