Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp562028ybv; Sat, 22 Feb 2020 09:21:20 -0800 (PST) X-Google-Smtp-Source: APXvYqyEg9zsjD6iXqcF28sg1qUF08jbs4NcCQVO5VmLwHqpYMu1EVoOipzsKjbs4Ur72esjpeyw X-Received: by 2002:a05:6830:1188:: with SMTP id u8mr33610284otq.274.1582392080634; Sat, 22 Feb 2020 09:21:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582392080; cv=none; d=google.com; s=arc-20160816; b=WReiCe7Br1tXyI3zmU5sa1tK8goMvEeVBUmHaywsBeaFVPeRk/jHn+tUGRi/TvEqwb /q9mnJt14C1Y726hj8ZFpa46FgFti5hUdUAIcKkdBNCRN+5t4LgjWKMAC8q3+YkOXavX vuBrc3A5VE5tDEdmz4HG3hY2Km2pQsCSvviOBuFyX0dLjQTiULyIJ+iswa9tg61WQNhc aKoKxQOyD+WRF85Z/lcZySE4BySSsXAJewGcJey0qgsWn26v4Tmql5Xsw6qBVRCCfHDZ 7GPu6BtIg6uv9tQQeQV6xSPeF2UDN5qri0tUu7pud8E8IWIzCMb8eBJBybZhPL+Ajt4N ddMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=76mGlpp6BFJSmPDHJW6kprv/8C2HQ3fa7ORMT87pipU=; b=hk4gnKYy/0w6h5cUv0XuFRpzx3Drn5hPtGxkkmHbD7JcNhwBH87ubSFF4vrZwbExxR HibI5aUHS1D7tF6fsISZI/gESYfyHMbOW68n99hPcFCvOOIj6K4metdTsvY4L4g0KMeL iQ1Fbx7JHBkF+twZwvXgJ4SNSAEux1FVZewWSjhzxj5GyDsaJYA6zG6KOJsnCRUCfxdx 4Qm3Qe6KfsJU86CJ52VhIDsDFVdXQJZsIO/ytYy54lxlRu81Z59koo5ri0P/EBejM6VL jE15+6NP04ZkjO7OEg+kaGnZDHlbiUfrZ+eWqxQhX/CZfM1xK9rptykp7o8D2VzRztX2 0MVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AhvXtgXr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6si3623364otp.17.2020.02.22.09.21.07; Sat, 22 Feb 2020 09:21:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AhvXtgXr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726813AbgBVRUT (ORCPT + 99 others); Sat, 22 Feb 2020 12:20:19 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37313 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbgBVRUT (ORCPT ); Sat, 22 Feb 2020 12:20:19 -0500 Received: by mail-pl1-f195.google.com with SMTP id c23so2219593plz.4; Sat, 22 Feb 2020 09:20:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=76mGlpp6BFJSmPDHJW6kprv/8C2HQ3fa7ORMT87pipU=; b=AhvXtgXr8v/7hcsVNalXOtAMxUQGg+OE/SI9/59KpjrJJKTzdFu6gUOq/LuJRpqBY0 FYwSgXktGDhXnxJhU2U90NIxa+7RN66/jwTwRNLQhjLZWDu4ngBO04tPrP5ZGeqWwsa4 Sby6zAhTXe+ZJh0Ro82a7S+HR0pUgR6wT4d0onSlnyKCWfcSG35Jr22+4olJ7iiexMQx qFkGQxPKNG65rZfE0ngObnTGSx4jRB2mrHaLqMMerAIcn3pm+dOIofsrj0NE5RO03RW+ OcXxr6GO++1LxMqSozC0UQxPEgpBW2CNB/gtyo6QKlW3lwjmFII7A9faa5wJet69n5lo 6yGw== 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:mime-version :content-transfer-encoding; bh=76mGlpp6BFJSmPDHJW6kprv/8C2HQ3fa7ORMT87pipU=; b=pxUqQU732q/sBAfmZlkz8aFi0n2B6ybFB35k/PFbCKVKq3l3qnNAeFQAX8NPf7N398 gn1/+TB7d+rEb7Zn1nvK6uPstK++8H2V1LjiY1xIGzgX+0Oi7FlauEpK7mifwyAuS3gS iAWkJpJMrv0Y4cxZsWQgN1R9EoZgEVp3r27sosQ4fxNdGPMwGvd8kV6P3YP9xeghz40k nkk/VDdmPU6baywDc3zLHqdZbyo+O5EpsW5t8d3Ug3IL/DRd6exfs6xGmP+0vInd77XV Q1pHGKI+QgrFEgS5+Mq1MXaKeAvf9NebhKUCEZPD8zrI+r1q/aerSkwOE0u6kuD3OMgL h1dw== X-Gm-Message-State: APjAAAWisnf889QnUEpsFEvHHthIg50IftdwPkZ0Y56EBkyVvz2LApw5 Bh8R6/EFXxvZAInb6MQkzYT8xzn+0N4= X-Received: by 2002:a17:90a:ca12:: with SMTP id x18mr10118744pjt.66.1582392018775; Sat, 22 Feb 2020 09:20:18 -0800 (PST) Received: from localhost.localdomain ([103.87.57.201]) by smtp.googlemail.com with ESMTPSA id o19sm10305622pjr.2.2020.02.22.09.20.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Feb 2020 09:20:18 -0800 (PST) From: Amol Grover To: James Morris , "Serge E . Hallyn" Cc: linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Joel Fernandes , Madhuparna Bhowmik , "Paul E . McKenney" , linux-security-module@vger.kernel.org, Amol Grover Subject: [PATCH] device_cgroup: Fix RCU list debugging warning Date: Sat, 22 Feb 2020 22:49:39 +0530 Message-Id: <20200222171938.14339-1-frextrite@gmail.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org exceptions may be traversed using list_for_each_entry_rcu() outside of an RCU read side critical section BUT under the protection of decgroup_mutex. Hence add the corresponding lockdep expression to fix the following false-positive warning: [ 2.304417] ============================= [ 2.304418] WARNING: suspicious RCU usage [ 2.304420] 5.5.4-stable #17 Tainted: G E [ 2.304422] ----------------------------- [ 2.304424] security/device_cgroup.c:355 RCU-list traversed in non-reader section!! Signed-off-by: Amol Grover --- security/device_cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/device_cgroup.c b/security/device_cgroup.c index 7d0f8f7431ff..b7da9e0970d9 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c @@ -352,7 +352,8 @@ static bool match_exception_partial(struct list_head *exceptions, short type, { struct dev_exception_item *ex; - list_for_each_entry_rcu(ex, exceptions, list) { + list_for_each_entry_rcu(ex, exceptions, list, + lockdep_is_held(&devcgroup_mutex)) { if ((type & DEVCG_DEV_BLOCK) && !(ex->type & DEVCG_DEV_BLOCK)) continue; if ((type & DEVCG_DEV_CHAR) && !(ex->type & DEVCG_DEV_CHAR)) -- 2.24.1