diff for duplicates of <mid:11> diff --git a/a/1.txt b/N1/1.txt index c8b94a3..de5b0dd 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,40 +1,52 @@ -Hi Thang, - -On Thu, 01 Oct 2026 17:01:18 +0200, Nguyen Ngoc Thang wrote: -> Take the socket spinlock instead, the same way the x25 timers and -> receive -> path already do. If the socket is not owned by user, disconnect it -> right -> away. If it is, mark it with X25_KILL_FLAG and let a new release_cb do -> the disconnect when the owner releases the socket. - -This is the approach I'd like to take, rather than deferring the whole -cleanup to a workqueue as proposed since. syzbot still hits the bug, -now also as https://syzkaller.appspot.com/bug?extid=300375dfd44665f063a6 - -The two new findings of the AI review hold up in practice. I tested -with two lapbether devices on a veth pair and a sender stalled in -x25_sendmsg() via userfaultfd, so that the socket is owned when the -link event arrives: - -- after a RESTART, a CALL REQUEST on the old LCI is queued to the - flagged socket's backlog and never reaches the listener; -- the flagged socket still transmits: a DATA packet on its old LCI - after the restart, and after a LAPB disconnect it brings the link - back up (SABM) before release_cb runs. - -Skipping flagged sockets in __x25_find_socket() and returning early -from x25_kick() and x25_write_internal() for them fixes both. Those two -functions cover everything a socket transmits, and the deferred -x25_disconnect() only changes local state. Clearing the flag in -x25_make_new() takes care of the inheritance issue. - -The x25_sendmsg()/x25_output() issue is pre-existing and independent; -I have a separate patch for it. - -I have these changes on top of your patch, together with the separate -fix, and the series passes the tests above with lockdep and -DEBUG_ATOMIC_SLEEP. Unless you'd like to send the v2 yourself, I'll -post it in a few days, with you as the author of the main patch. +Hi Shuai, + +On Mon, 23 Nov 2026 04:47:48 +0100, Shuai Liu wrote: +> Changes in v3: +> - Flush kill_work in NETDEV_CHANGE as well, restoring synchronous +> socket cleanup for both process-context notifier events (Sashiko) + +The NETDEV_CHANGE flush is fine, but I don't agree that the medium +issue from the review is not actionable, and I don't want to take the +workqueue approach. + +In your reply to the review you wrote: +> The deferred work runs within microseconds of the event, long before +> the peer can deliver any new frame. + +That only holds while no socket on the link is owned by a task. The +worker sleeps in lock_sock() until the owner releases the socket, which +is exactly the case in which the current code sleeps in softirq, and an +owner holds the socket for as long as its send buffer takes to fault +in. Until then, every call on the link keeps its LCI binding. + +I tested v3 with two lapbether devices on a veth pair and a sender +stalled in x25_sendmsg() via userfaultfd, so that its socket is owned +when the link event arrives: + +- after a LAPB disconnect, the stalled call itself brings the link back + up (SABM) before it is cleared, so the peer can reach us again while + the old calls are still bound; +- after a RESTART, a CALL REQUEST on the old LCI, sent two seconds after + the restart was confirmed, never reaches the listener, and the old + call sends a DATA packet on that LCI. + +Neither involves frames that were in flight before the restart. + +> Detaching the sockets synchronously in softirq would require writing +> x25->neighbour / lci / state from BH without lock_sock() + +It doesn't. Thang's patch from October [1] uses the pattern that +x25_receive_data() and the x25 timers already use: under +bh_lock_sock(), a socket that is not owned is cleared right away, and an +owned one only gets an atomic flag and is cleared by its owner from +release_cb. Its v2 also skips flagged sockets in __x25_find_socket() and +keeps them from transmitting, which fixes both cases above in the same +test. I'll post it in the next days. + +Also, please post new versions as a new thread, with the version in the +subject of the patch itself, not as a reply to the previous posting. + +[1] +https://lore.kernel.org/all/20261001150118.128470-1-ngocthang2710.1999@gmail.com/ pw-bot: changes-requested diff --git a/a/content_digest b/N1/content_digest index fbadb49..6c1ac68 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,60 +1,72 @@ - "ref\020261001150118.128470-1-ngocthang2710.1999@gmail.com\0" + "ref\0179539800759.3135.17245752044060918891@kernel.org\0" + "ref\0tencent_8BA4FF587EE5579AB67149C5062618DC7109@qq.com\0" "From\0Martin Schiller <ms@dev.tdt.de>\0" - "Subject\0Re: [PATCH net] net/x25: don't call lock_sock() from softirq in x25_kill_by_neigh()\0" - "Date\0Mon, 23 Nov 2026 08:57:40 +0100 (CET)\0" - "To\0Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>\0" + "Subject\0Re: [PATCH] x25: defer socket cleanup on link termination to process context\0" + "Date\0Mon, 23 Nov 2026 09:03:49 +0100 (CET)\0" + "To\0Shuai Liu <847807867@qq.com>\0" "Cc\0David S. Miller <davem@davemloft.net>" Eric Dumazet <edumazet@kernel.org> Jakub Kicinski <kuba@kernel.org> Paolo Abeni <pabeni@redhat.com> Simon Horman <horms@kernel.org> + Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com> linux-x25@vger.kernel.org netdev@vger.kernel.org linux-kernel@vger.kernel.org - Duoming Zhou <duoming@zju.edu.cn> - Lin Ma <linma@zju.edu.cn> - " syzbot+9faa82ae2e94c5c7d2ef@syzkaller.appspotmail.com\0" + " syzbot+300375dfd44665f063a6@syzkaller.appspotmail.com\0" "\00:1\0" "b\0" - "Hi Thang,\n" - "\n" - "On Thu, 01 Oct 2026 17:01:18 +0200, Nguyen Ngoc Thang wrote:\n" - "> Take the socket spinlock instead, the same way the x25 timers and \n" - "> receive\n" - "> path already do. If the socket is not owned by user, disconnect it \n" - "> right\n" - "> away. If it is, mark it with X25_KILL_FLAG and let a new release_cb do\n" - "> the disconnect when the owner releases the socket.\n" - "\n" - "This is the approach I'd like to take, rather than deferring the whole\n" - "cleanup to a workqueue as proposed since. syzbot still hits the bug,\n" - "now also as https://syzkaller.appspot.com/bug?extid=300375dfd44665f063a6\n" - "\n" - "The two new findings of the AI review hold up in practice. I tested\n" - "with two lapbether devices on a veth pair and a sender stalled in\n" - "x25_sendmsg() via userfaultfd, so that the socket is owned when the\n" - "link event arrives:\n" - "\n" - "- after a RESTART, a CALL REQUEST on the old LCI is queued to the\n" - " flagged socket's backlog and never reaches the listener;\n" - "- the flagged socket still transmits: a DATA packet on its old LCI\n" - " after the restart, and after a LAPB disconnect it brings the link\n" - " back up (SABM) before release_cb runs.\n" - "\n" - "Skipping flagged sockets in __x25_find_socket() and returning early\n" - "from x25_kick() and x25_write_internal() for them fixes both. Those two\n" - "functions cover everything a socket transmits, and the deferred\n" - "x25_disconnect() only changes local state. Clearing the flag in\n" - "x25_make_new() takes care of the inheritance issue.\n" - "\n" - "The x25_sendmsg()/x25_output() issue is pre-existing and independent;\n" - "I have a separate patch for it.\n" - "\n" - "I have these changes on top of your patch, together with the separate\n" - "fix, and the series passes the tests above with lockdep and\n" - "DEBUG_ATOMIC_SLEEP. Unless you'd like to send the v2 yourself, I'll\n" - "post it in a few days, with you as the author of the main patch.\n" + "Hi Shuai,\n" + "\n" + "On Mon, 23 Nov 2026 04:47:48 +0100, Shuai Liu wrote:\n" + "> Changes in v3:\n" + "> - Flush kill_work in NETDEV_CHANGE as well, restoring synchronous\n" + "> socket cleanup for both process-context notifier events (Sashiko)\n" + "\n" + "The NETDEV_CHANGE flush is fine, but I don't agree that the medium\n" + "issue from the review is not actionable, and I don't want to take the\n" + "workqueue approach.\n" + "\n" + "In your reply to the review you wrote:\n" + "> The deferred work runs within microseconds of the event, long before\n" + "> the peer can deliver any new frame.\n" + "\n" + "That only holds while no socket on the link is owned by a task. The\n" + "worker sleeps in lock_sock() until the owner releases the socket, which\n" + "is exactly the case in which the current code sleeps in softirq, and an\n" + "owner holds the socket for as long as its send buffer takes to fault\n" + "in. Until then, every call on the link keeps its LCI binding.\n" + "\n" + "I tested v3 with two lapbether devices on a veth pair and a sender\n" + "stalled in x25_sendmsg() via userfaultfd, so that its socket is owned\n" + "when the link event arrives:\n" + "\n" + "- after a LAPB disconnect, the stalled call itself brings the link back\n" + " up (SABM) before it is cleared, so the peer can reach us again while\n" + " the old calls are still bound;\n" + "- after a RESTART, a CALL REQUEST on the old LCI, sent two seconds after\n" + " the restart was confirmed, never reaches the listener, and the old\n" + " call sends a DATA packet on that LCI.\n" + "\n" + "Neither involves frames that were in flight before the restart.\n" + "\n" + "> Detaching the sockets synchronously in softirq would require writing\n" + "> x25->neighbour / lci / state from BH without lock_sock()\n" + "\n" + "It doesn't. Thang's patch from October [1] uses the pattern that\n" + "x25_receive_data() and the x25 timers already use: under\n" + "bh_lock_sock(), a socket that is not owned is cleared right away, and an\n" + "owned one only gets an atomic flag and is cleared by its owner from\n" + "release_cb. Its v2 also skips flagged sockets in __x25_find_socket() and\n" + "keeps them from transmitting, which fixes both cases above in the same\n" + "test. I'll post it in the next days.\n" + "\n" + "Also, please post new versions as a new thread, with the version in the\n" + "subject of the patch itself, not as a reply to the previous posting.\n" + "\n" + "[1] \n" + "https://lore.kernel.org/all/20261001150118.128470-1-ngocthang2710.1999@gmail.com/\n" "\n" pw-bot: changes-requested -ebae34eb5f6ad9ffbbb7ad309d8214a5c0d939b8c124aff9b2617895bbf8158e +49c9822da9c5d9b9010004bafad8394ef0681f27154f4425fd94bee397bff76b
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox