From patchwork Thu Sep 3 00:14:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 7114291 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 023DD9F372 for ; Thu, 3 Sep 2015 00:14:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15D192061A for ; Thu, 3 Sep 2015 00:14:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 05C8C20606 for ; Thu, 3 Sep 2015 00:14:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755335AbbICAOj (ORCPT ); Wed, 2 Sep 2015 20:14:39 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:36829 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755112AbbICAOi (ORCPT ); Wed, 2 Sep 2015 20:14:38 -0400 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 2 Sep 2015 18:14:37 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 2 Sep 2015 18:14:36 -0600 X-Helo: d03dlp01.boulder.ibm.com X-MailFrom: paulmck@linux.vnet.ibm.com X-RcptTo: linux-security-module@vger.kernel.org Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id B40351FF0041; Wed, 2 Sep 2015 18:05:44 -0600 (MDT) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t830DVOS54198300; Wed, 2 Sep 2015 17:13:31 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t830EYIu018719; Wed, 2 Sep 2015 18:14:35 -0600 Received: from paulmck-ThinkPad-W500 (paulmck-thinkpad-w500.au.ibm.com [9.192.250.79]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t830EX6I018677; Wed, 2 Sep 2015 18:14:34 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 666F5381B39; Wed, 2 Sep 2015 17:14:33 -0700 (PDT) Date: Wed, 2 Sep 2015 17:14:33 -0700 From: "Paul E. McKenney" To: Tejun Heo Cc: Felipe Balbi , James Morris , serge@hallyn.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Linux OMAP Mailing List Subject: Re: [PATCH v2] security: device_cgroup: fix RCU lockdep splat Message-ID: <20150903001433.GB4029@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20150902125608.GA8299@saruman.tx.rr.com> <1441199548-29633-1-git-send-email-balbi@ti.com> <20150902162450.GJ22326@mtj.duckdns.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150902162450.GJ22326@mtj.duckdns.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15090300-0013-0000-0000-000017EB14AA Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Sep 02, 2015 at 12:24:50PM -0400, Tejun Heo wrote: > cc'ing Paul. > > On Wed, Sep 02, 2015 at 08:12:28AM -0500, Felipe Balbi wrote: > > while booting AM437x device, the following splat > > triggered: > > > > [ 12.005238] =============================== > > [ 12.009749] [ INFO: suspicious RCU usage. ] > > [ 12.014116] 4.2.0-next-20150831 #1154 Not tainted > > [ 12.019050] ------------------------------- > > [ 12.023408] security/device_cgroup.c:405 device_cgroup:verify_new_ex called without proper synchronization! > ... > > [ 12.128326] [] (verify_new_ex) from [] (devcgroup_access_write+0x374/0x658) > > [ 12.137426] [] (devcgroup_access_write) from [] (cgroup_file_write+0x28/0x1bc) > > [ 12.146796] [] (cgroup_file_write) from [] (kernfs_fop_write+0xc0/0x1b8) > > [ 12.155620] [] (kernfs_fop_write) from [] (__vfs_write+0x1c/0xd8) > > [ 12.163783] [] (__vfs_write) from [] (vfs_write+0x90/0x16c) > > [ 12.171426] [] (vfs_write) from [] (SyS_write+0x44/0x9c) > > [ 12.178806] [] (SyS_write) from [] (ret_fast_syscall+0x0/0x1c) > > This shouldn't be happening because devcgroup_access_write() always > grabs devcgroup_mutex. Looking at the log, the culprit seems to be > f78f5b90c4ff ("rcu: Rename rcu_lockdep_assert() to > RCU_LOCKDEP_WARN()"). It missed the bang for the second test while > inverting it, so adding rcu_read_lock() isn't the right fix here. > > Paul, can you please fix it? Gah! Please see below. Thanx, Paul ------------------------------------------------------------------------ security/device_cgroup: Fix RCU_LOCKDEP_WARN() condition f78f5b90c4ff ("rcu: Rename rcu_lockdep_assert() to RCU_LOCKDEP_WARN()") introduced a bug by incorrectly inverting the condition when moving from rcu_lockdep_assert() to RCU_LOCKDEP_WARN(). This commit therefore fixes the inversion. Reported-by: Felipe Balbi Reported-by: Tejun Heo Signed-off-by: Paul E. McKenney Cc: Serge Hallyn Acked-by: Serge Hallyn Tested-by: Josh Boyer --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/security/device_cgroup.c b/security/device_cgroup.c index 73455089feef..03c1652c9a1f 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c @@ -401,7 +401,7 @@ static bool verify_new_ex(struct dev_cgroup *dev_cgroup, bool match = false; RCU_LOCKDEP_WARN(!rcu_read_lock_held() && - lockdep_is_held(&devcgroup_mutex), + !lockdep_is_held(&devcgroup_mutex), "device_cgroup:verify_new_ex called without proper synchronization"); if (dev_cgroup->behavior == DEVCG_DEFAULT_ALLOW) {