Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1559032
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Eric Dumazet <eric.dumazet@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] can: Fix kernel panic at security_sock_rcv_skb |
| Date | Sat, 14 Jan 2017 18:40:01 +0100 |
| Message-ID | <sZAt3-if-1@gated-at.bofh.it> (permalink) |
| References | <sYHdg-CK-3@gated-at.bofh.it> <sYIVH-1G5-1@gated-at.bofh.it> <sYNiF-4mX-3@gated-at.bofh.it> <sYQzV-6d7-45@gated-at.bofh.it> <sZnvQ-Zl-5@gated-at.bofh.it> <sZx29-6CR-1@gated-at.bofh.it> |
| X-Original-To | Oliver Hartkopp <socketcan@hartkopp.net> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=R7mxIoB27bIxMj1duOTe1dAuIdhZjPDl7S9amssRV8s=; b=baQhHsNxhyAe2FfWIr+6reA9tTIT+JJc/zDsAedvo6Z7QQb1ZWklrna6mdB390vXQ2 J54rydBOCz74Jnfhvi2VYL/cXquskZ3yOHrLV145XcwqEjpSzPTScCXJihGi5vPrFmT2 BlejzeXIElHGBZA7YxccWoYjS3dOGKY2IhIDfzBw3cKRVZUWtwBByP1zsb8XgP/yZ9We MQb02giPT+RNUebk56AM36pFzeOIT3mbe/AkQizAPBHph+R9L90G4GSP7ONOJ8buw6oS HXTWN9lU4h1wXaLojb38jJuldQ2dq3aMcnlFFjTfBOgJW6l1NFMOBQPxZeyNx13rl924 D4vA== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=R7mxIoB27bIxMj1duOTe1dAuIdhZjPDl7S9amssRV8s=; b=TL3wEc511AnGnQ9My3ENZYwduxQhTuvLTmD3cXy6TI/zCxYuznkFokW8Rixx72E252 4sdVFhpuUHYBO/s9yHpQhsTn7NH0tbCBzLBJ3QJgJQNqlua4Oom+3Rmij4Iv5LPRjZkf 2NWLmt6rbqOBr+OWZKEveAXyF4JsofeHny2cgO6ugFcA69TfHofy03hDTdZh4lF8eD4t RMS7887aIFULN6P4hVmsmXL4VmcYaB+GDbyHce/ihsoHtGtoteWNl9AwBtD+IzzNdsRU sPz0vnvJcb+iHcyS5NCWtaokP+Zl4QcYofQqROVj6qzGZ75IQ381r4ZHSOu7hMw4eYIG CDBw== |
| X-Gm-Message-State | AIkVDXLDV6NzACMpZMwXFFXHG9LdxFgHUbGW4wyLi5M469dFBNwAljfV9Y0zsG80nVP85A== |
| X-Received | by 10.99.189.26 with SMTP id a26mr30399114pgf.67.1484415037446; Sat, 14 Jan 2017 09:30:37 -0800 (PST) |
| Content-Type | text/plain; charset="UTF-8" |
| X-Mailer | Evolution 3.10.4-0ubuntu2 |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | 7bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 55 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Liu Shuo <shuo.a.liu@intel.com>, linux-kernel@vger.kernel.org, yanmin_zhang@linux.intel.com, shuox.liu@gmail.com, Zhang Yanmin <yanmin.zhang@intel.com>, "He, Bo" <bo.he@intel.com>, Marc Kleine-Budde <mkl@pengutronix.de>, "David S. Miller" <davem@davemloft.net>, "open list:CAN NETWORK LAYER" <linux-can@vger.kernel.org>, "open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org> |
| X-Original-Date | Sat, 14 Jan 2017 09:30:35 -0800 |
| X-Original-Message-ID | <1484415035.13165.57.camel@edumazet-glaptop3.roam.corp.google.com> |
| X-Original-References | <1484202799-7287-1-git-send-email-shuo.a.liu@intel.com> <0e458012-e97b-298d-296e-ed25e35689a0@hartkopp.net> <1484226099.15816.25.camel@edumazet-glaptop3.roam.corp.google.com> <9e6817a0-65b3-ed16-4616-f8e55aee09c4@hartkopp.net> <20170114034330.GA30070@shuo-desktop.sh.intel.com> <6dc1d111-9aa4-5771-0283-6408567e47c2@hartkopp.net> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1559032 |
Show key headers only | View raw
On Sat, 2017-01-14 at 14:53 +0100, Oliver Hartkopp wrote:
> Hello Eric,
>
> On 01/14/2017 04:43 AM, Liu Shuo wrote:
> > On Thu 12.Jan'17 at 17:33:38 +0100, Oliver Hartkopp wrote:
> >> On 01/12/2017 02:01 PM, Eric Dumazet wrote:
>
> >>> The main problem seems that the sockets themselves are not RCU
> >>> protected.
> >>>
> >>> If CAN uses RCU for delivery, then sockets should be freed only after
> >>> one RCU grace period.
> >>>
> >>> On recent kernels, following patch could help :
> >>>
> >>
> >> Thanks Eric!
> >>
> >> @Liu ShuoX: Can you check if Eric's suggestion fixes the issue in your
> >> setup?
> > Sorry for late reply. I was OOO yesterday.
> > With Eric's hint, i just found his patch that "net: add SOCK_RCU_FREE
> > socket flag" in the latest kernel. With backporting this one plus Eric's
> > following patch, it fixs my failure.
>
> what would be the best approach to fix this issue - even in stable kernels?
>
> E.g. would this change be ok for a stable as a quick fix?
>
> diff --git a/net/can/af_can.c b/net/can/af_can.c
> index 1108079d934f..6b974c2b66ef 100644
> --- a/net/can/af_can.c
> +++ b/net/can/af_can.c
> @@ -112,6 +112,7 @@ EXPORT_SYMBOL(can_ioctl);
>
> static void can_sock_destruct(struct sock *sk)
> {
> + synchronize_rcu();
> skb_queue_purge(&sk->sk_receive_queue);
> }
Adding a synchronize_rcu() at socket close time might have side effects,
if say an application had 1000 such sockets and dies.
This might add 20 seconds of exit time and have serious implications.
I will submit the second patch : It is working for all linux versions.
>
> And once this arrived in the mainline tree your suggested patch could be
> applied?
>
> In any case we should not forget to give Reported-by credits to Liu.
Sure
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] can: Fix kernel panic at security_sock_rcv_skb Liu ShuoX <shuo.a.liu@intel.com> - 2017-01-12 07:40 +0100
Re: [PATCH] can: Fix kernel panic at security_sock_rcv_skb Oliver Hartkopp <socketcan@hartkopp.net> - 2017-01-12 09:30 +0100
Re: [PATCH] can: Fix kernel panic at security_sock_rcv_skb Eric Dumazet <eric.dumazet@gmail.com> - 2017-01-12 14:10 +0100
Re: [PATCH] can: Fix kernel panic at security_sock_rcv_skb Oliver Hartkopp <socketcan@hartkopp.net> - 2017-01-12 17:40 +0100
Re: [PATCH] can: Fix kernel panic at security_sock_rcv_skb Liu Shuo <shuo.a.liu@intel.com> - 2017-01-14 04:50 +0100
Re: [PATCH] can: Fix kernel panic at security_sock_rcv_skb Oliver Hartkopp <socketcan@hartkopp.net> - 2017-01-14 15:00 +0100
Re: [PATCH] can: Fix kernel panic at security_sock_rcv_skb Eric Dumazet <eric.dumazet@gmail.com> - 2017-01-14 18:40 +0100
csiph-web