From patchwork Thu Dec 28 19:00:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Herbert X-Patchwork-Id: 853522 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quantonium-net.20150623.gappssmtp.com header.i=@quantonium-net.20150623.gappssmtp.com header.b="EfKYpLUW"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3z6zZq1hDsz9t2M for ; Fri, 29 Dec 2017 06:01:07 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754079AbdL1TBE (ORCPT ); Thu, 28 Dec 2017 14:01:04 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:37319 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753894AbdL1TBD (ORCPT ); Thu, 28 Dec 2017 14:01:03 -0500 Received: by mail-pl0-f65.google.com with SMTP id s3so21588451plp.4 for ; Thu, 28 Dec 2017 11:01:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantonium-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GtAQnbHRZWkBQcrxV9AxSIJysHtC14urLNei8zfthGk=; b=EfKYpLUWVBMd/X6m07wy+KP3VnLUu6OcdpHWVCH330Njp/jyljmg9WPT7UHM/KzGbP dSCqI5N8niMy5HdCiLt3xVEB6s2DTww6kCAJN5w7vc2Cb0SBXWqoNFBd8AdPjItXqhgH WQdcvvthxkzWwkkaA+29TIo0iyWaHIoqfXrilFZ1qZDdjPF98gVHSQg6uHIhrkyflzwl P9ONtvnuJQ6nBiP5yJFSBfq+gtm1ja39JoJfsdj86cYub+8uX4Ao/phAl4jFaNhOGKlF oHwjPfa/TtEJXi5jMDHOVyfVT8mq7PYfKYywsz2hJ7tWPUB+aOGCtkWGO2m/YUz8YDC7 a7CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GtAQnbHRZWkBQcrxV9AxSIJysHtC14urLNei8zfthGk=; b=TuQ0lMtyhbnN2FoGOLrlBeNQv+/5epaCMVgvyDdOtVt7VtkV8d2FWlaQvzT80agcut AXRAvwZ410w6hd8M/PcKkbfYkeNcu3+2uNUb4iTEeYe7YxfIEW4bYOb0+NB0gZZCGU25 USj1F8oGpSjl01smY6HR4AZEwcOcOqc9FB5KuHqp/8zxDd3IqqHzuwWSq3w0MADUQ8g1 JfKljRtCnPXExyQp7040wv3I3Zn44PTiJO3nm4Hd1rgNojP4w5jXJ106H0qn9CgQpa13 TU9p7kV0wHu63tuRlM2nKDAWGRPXUvXPVqL54seIulkNiYJkRKTbeXFdzQrFyHiwR+GQ BK7A== X-Gm-Message-State: AKGB3mJlXMSmSc0yt8S5zJ3TkbEXEdzXuM+qhj7TzphCFE3++3jdRUPW 9QNkgkaBkx4SOkrcI2DpA3ytzQ== X-Google-Smtp-Source: ACJfBovK0MjvgmaSVLuAZbJxQq2VDd6D9CZaaV2Tx6SDurq0dU3EwAv9sU6DFjb4hTLX+WHvVRpk8g== X-Received: by 10.84.214.2 with SMTP id h2mr33552926pli.142.1514487663078; Thu, 28 Dec 2017 11:01:03 -0800 (PST) Received: from localhost.localdomain (c-73-162-13-107.hsd1.ca.comcast.net. [73.162.13.107]) by smtp.gmail.com with ESMTPSA id k89sm70277536pfb.104.2017.12.28.11.01.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Dec 2017 11:01:02 -0800 (PST) From: Tom Herbert To: davem@davemloft.net Cc: netdev@vger.kernel.org, dvyukov@google.com, ozgur@goosey.org, rohit@quantonium.net, Tom Herbert Subject: [PATCH net 1/2] sock: Add sock_owned_by_user_nocheck Date: Thu, 28 Dec 2017 11:00:43 -0800 Message-Id: <20171228190044.3748-2-tom@quantonium.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171228190044.3748-1-tom@quantonium.net> References: <20171228190044.3748-1-tom@quantonium.net> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This allows checking socket lock ownership with producing lockdep warnings. Signed-off-by: Tom Herbert --- include/net/sock.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/net/sock.h b/include/net/sock.h index 9155da422692..7a7b14e9628a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1514,6 +1514,11 @@ static inline bool sock_owned_by_user(const struct sock *sk) return sk->sk_lock.owned; } +static inline bool sock_owned_by_user_nocheck(const struct sock *sk) +{ + return sk->sk_lock.owned; +} + /* no reclassification while locks are held */ static inline bool sock_allow_reclassification(const struct sock *csk) { From patchwork Thu Dec 28 19:00:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Herbert X-Patchwork-Id: 853523 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quantonium-net.20150623.gappssmtp.com header.i=@quantonium-net.20150623.gappssmtp.com header.b="F9Og8jB5"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3z6zZt0nPkz9sRW for ; Fri, 29 Dec 2017 06:01:10 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754087AbdL1TBI (ORCPT ); Thu, 28 Dec 2017 14:01:08 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:44133 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753894AbdL1TBH (ORCPT ); Thu, 28 Dec 2017 14:01:07 -0500 Received: by mail-pl0-f66.google.com with SMTP id n13so21619787plp.11 for ; Thu, 28 Dec 2017 11:01:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantonium-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IhZy4NF1bJGFry80WAHctWW29OmRzQazhCnUyFhkGFo=; b=F9Og8jB5r1EYAWcie7cxjN6ZRbAnEFmJ/PPzX5fWvkCslLID9BE2lHpUoCk4fdCMhw CV0cfEs3hpQZBqpdcqR/U6SqYME/Hs+4XsmIVyPaggUetgwcn2D4PfKbbYhnH+lPoBDD WFdhQz/oFWlBP17OTgJui23y3GKVF4cH3jfrvgg2/KdKqgZ3Ya5rCFjAe1uKwcXeHaWv q85npEkPkZW91XG98X10jxryIRluNnSQw0GCtbOzMbX16siBSHDuUglIX2/gP6CF/bji KuH7DXahm7ju8e5Clbichak6lw3JX9vjrwtvYQSUDcOQL6o7MoXcAbg/BiOH3G23dLAw v8MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IhZy4NF1bJGFry80WAHctWW29OmRzQazhCnUyFhkGFo=; b=mzY9OeDec2H61HgJdLqzBBUhOtaidmbuwVPm39CBsD8yia/sP0ZHf8hrljdl/wwnq2 NslNI+rBcGNiTOD/YSFySPZ95hYxWwK61ENPFk2bxIVo0XEKqWTvfsF87ycUMOBVRqlw +DG5YgS5nj0HliRRuSkJlqKF/Cb/5mYCLPb1SA/svqJyW/rZ040wpnt0I/7MJWUcAsfj 5um1QjX2H8vzG4jBXv6VGeI2zmhlNNOQRfV5uNHYKqZIINzMbnlhRrDFOH3Mnok9rvQs yQQK99Cd3equm2OFgY4mU3fjVpM0n/pb7QrlDPbEFfIyDr39YOj99lW/v9SCDRse94pe ul6w== X-Gm-Message-State: AKGB3mJzlzfqvYcmp+NGSKrY6YAAk5/bMKcGulvnINpSwiucEFOpYuem F8/j8QN+tpeYCo1kZ2vaRIa5Jw== X-Google-Smtp-Source: ACJfBov8gClCxE/kLU08aE9+phjDhYvo+/IcfA3uFePzqiyrYA8REAX9DFGKX1SSRJZs3pWDKFaSFw== X-Received: by 10.159.230.3 with SMTP id u3mr31551477plq.2.1514487666641; Thu, 28 Dec 2017 11:01:06 -0800 (PST) Received: from localhost.localdomain (c-73-162-13-107.hsd1.ca.comcast.net. [73.162.13.107]) by smtp.gmail.com with ESMTPSA id k89sm70277536pfb.104.2017.12.28.11.01.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Dec 2017 11:01:05 -0800 (PST) From: Tom Herbert To: davem@davemloft.net Cc: netdev@vger.kernel.org, dvyukov@google.com, ozgur@goosey.org, rohit@quantonium.net, Tom Herbert Subject: [PATCH net 2/2] strparser: Call sock_owned_by_user_nocheck Date: Thu, 28 Dec 2017 11:00:44 -0800 Message-Id: <20171228190044.3748-3-tom@quantonium.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171228190044.3748-1-tom@quantonium.net> References: <20171228190044.3748-1-tom@quantonium.net> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org strparser wants to check socket ownership without producing any warnings. As indicated by the comment in the code, it is permissible for owned_by_user to return true. Fixes: 43a0c6751a322847 ("strparser: Stream parser for messages") Reported-by: syzbot Reported-and-tested-by: Signed-off-by: Tom Herbert --- net/strparser/strparser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c index c5fda15ba319..1fdab5c4eda8 100644 --- a/net/strparser/strparser.c +++ b/net/strparser/strparser.c @@ -401,7 +401,7 @@ void strp_data_ready(struct strparser *strp) * allows a thread in BH context to safely check if the process * lock is held. In this case, if the lock is held, queue work. */ - if (sock_owned_by_user(strp->sk)) { + if (sock_owned_by_user_nocheck(strp->sk)) { queue_work(strp_wq, &strp->work); return; }