Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3218625ybb; Mon, 6 Apr 2020 04:42:28 -0700 (PDT) X-Google-Smtp-Source: APiQypKru+mtRfDMLNEbrGiW9gDwlaa41pViMPs8Kk3PmrKu5EGai36gBEPgSgNBhp6HbYs5TPY4 X-Received: by 2002:a9d:2002:: with SMTP id n2mr18051203ota.127.1586173348263; Mon, 06 Apr 2020 04:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586173348; cv=none; d=google.com; s=arc-20160816; b=kl6fw8SRjVGFkNUm1VWUCrz0KkO2vf2LdLqP8XmzzvNbXnW6vTv79KSm1KTtFfmuQN Cjnlga+4jNLH4xtf46pC+HGwTFVrlRIPY0H8XQ5QjPj38j7rFa4SjmwCpKeCsSTLfdw5 LgP4s5cDTc62SPm4UXvRwLB6sM0neUu0fEp6Rbi1WXzGpA5pr9qEuzGh/DFJzGVepg1i WakcLmqecBZSm2zKJy+v34o1XsdGEsEAQttC9q1esHaxA4/MYPLMcVz/Cxcm8/pNv4qZ eO9HuQCZQjOd/iddrW9jhUTqsFd1AAdRpeXGlTIVrb46kWcIHAqHfwu/jI92GZiZG82I zXoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=khaADiBEnPr/yBlje3uAgQCwft8k315e7ByTRXW7oXU=; b=QEl7LHhEJ/ZaPxSRAwOZHNQO56q4RUUWznTyYUNGZWHlTV/uPSVEc8g/4P6YYDOwdG CN2NKD8rZB1TARelf4g92AyB8eqzLtr+KfI3IamedYLTnkCZOM1f5ISZZ6X+gCehe7GQ MudBP2udLWTk3Q4Y1Si/PEbDMp0l+GAj6ZKXLWZ3uR1/wS7kqyQkCbpnHGfCBxSh0hZ/ jgO7zsmOmIxfLuTTDLCXrVNlg56CSFDz76IeKZLUco4ztIwWEJFnUfWJNOcDvlOFgIHr H1AVoH65D4Cc1xsiTHznO6/yC6WKA09+TVXmJCh/WuC3KHwEFPt2KUfKDTUgxpwLTdho JFDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y7uNUv3e; 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 d1si7815660otq.225.2020.04.06.04.42.16; Mon, 06 Apr 2020 04:42:28 -0700 (PDT) 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=Y7uNUv3e; 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 S1727356AbgDFLln (ORCPT + 99 others); Mon, 6 Apr 2020 07:41:43 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:37156 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727300AbgDFLlm (ORCPT ); Mon, 6 Apr 2020 07:41:42 -0400 Received: by mail-pf1-f194.google.com with SMTP id u65so7398358pfb.4; Mon, 06 Apr 2020 04:41:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=khaADiBEnPr/yBlje3uAgQCwft8k315e7ByTRXW7oXU=; b=Y7uNUv3efSr2xz7wgzuH02VmrQdMTpdIi9Lki3b4EulZLOaXcq6zPV9xdxNsmy2zoA +Fg3q9rbxLEDeHa3zHL4erFLTaIo3sgqAlXMrAxD60xNz4R5XskHZ3fsKd0uFt4HnDL6 nQh7weza2AFRwS02mIS73DxOnZSltucTfbgrKTXQbjT2ayU7ZIh11jEUEvtjh8W35AED Ss79dyu6WHDwKqzTWivLmUKRisan2bpjqKjGZOugHLv7NaInxYyho23+yZuelPD7RGhc gAe6mxV+1CpDji5bdZvh+7RxZ1btvvvmVStc/aB937wYJ8OzjELd9aQhujdLjU/z5rlf 2hkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=khaADiBEnPr/yBlje3uAgQCwft8k315e7ByTRXW7oXU=; b=aW1rF75rH9UZyri0DM5AbmM5hQFmzHBaV0LV3GHIoUw7nlIGbaEa8HHxwT89Tuv5FK nTe6m8M+hIxTOGXRVF07bmu4zEHrq5T5xehx9RHMQCHlIt4q6Z3Bndsdg9OhT9NtgjPT W/C/XZoENQyvWyBvIIfUrBZ4Q2idf1OEhDhRS9fWeOgg7djcQt0sRsAo5C16guMgei4B k+QobEJlnuXOWxyunow+t1D0qHcWv99iplmSW4KwUd8vVGWPE2P4Z3T6SvLtFHWJeInp 5OFPD7xRz5li5nfU4Zby0H6Euu4MtIv8cLN1VEsJgElVcN0rNkLmXWunx9BYqBCjmY6y WNOw== X-Gm-Message-State: AGi0PubsqKD1kOXtxBEVvrAbpWbbnZ+X00tQ0xUWCdpgORSsvWAjrrfm ZyMW8k7AkwnCX4CWoua82wE= X-Received: by 2002:a63:fe44:: with SMTP id x4mr19228097pgj.95.1586173300169; Mon, 06 Apr 2020 04:41:40 -0700 (PDT) Received: from workstation-kernel-dev ([103.87.57.178]) by smtp.gmail.com with ESMTPSA id r64sm11919208pjb.15.2020.04.06.04.41.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 04:41:39 -0700 (PDT) Date: Mon, 6 Apr 2020 17:11:34 +0530 From: Amol Grover To: John Johansen , James Morris , "Serge E. Hallyn" , Greg Kroah-Hartman , Armijn Hemel , Allison Randal , Thomas Gleixner Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: WARNING: suspicious RCU usage with PROVE_RCU_LIST=y Message-ID: <20200406114134.GA1010@workstation-kernel-dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, With respect to the patch https://lore.kernel.org/patchwork/patch/1202512/ I boot tested with CONFIG_PROVE_RCU_LIST=y and encountered a susppicious RCU usage warning in "security/apparmor/include/lib.h". I thought of going forward and fix it myself, however, while going through the stack trace and the actual code, I found that the function (__lookupn_profile) is required to be called with rcu_read_locK() but the splat proves it otherwise. [ 12.727582] ============================= [ 12.727599] WARNING: suspicious RCU usage [ 12.727601] 5.5.4-stable #17 Tainted: G E [ 12.727602] ----------------------------- [ 12.727604] security/apparmor/include/lib.h:191 RCU-list traversed in non-reader section!! [ 12.727605] other info that might help us debug this: [ 12.727606] rcu_scheduler_active = 2, debug_locks = 1 [ 12.727608] 2 locks held by apparmor_parser/506: [ 12.727609] #0: ffff9f0687562490 (sb_writers#10){.+.+}, at: vfs_write+0x140/0x1a0 [ 12.727614] #1: ffff9f0687f09ca8 (&ns->lock){+.+.}, at: aa_replace_profiles+0x17a/0xdd0 [ 12.727619] stack backtrace: [ 12.727621] CPU: 3 PID: 506 Comm: apparmor_parser Tainted: G E 5.5.4-stable #17 [ 12.727622] Hardware name: Gigabyte Technology Co., Ltd. Z170-D3H/Z170-D3H-CF, BIOS F21 03/06/2017 [ 12.727623] Call Trace: [ 12.727627] dump_stack+0x8f/0xd0 [ 12.727630] __lookupn_profile+0x19c/0x1a0 [ 12.727632] ? aa_unpack+0x51b/0x580 [ 12.727636] __lookup_replace+0x34/0xc0 [ 12.727640] aa_replace_profiles+0x2a0/0xdd0 [ 12.727649] policy_update+0x106/0x370 [ 12.727653] profile_replace+0xa3/0x110 [ 12.727657] vfs_write+0xb9/0x1a0 [ 12.727661] ksys_write+0x68/0xe0 [ 12.727666] do_syscall_64+0x5c/0xe0 [ 12.727669] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 12.727671] RIP: 0033:0x7ff83fec7f93 [ 12.727673] Code: 75 05 48 83 c4 58 c3 e8 eb 41 ff ff 66 2e 0f 1f 84 00 00 00 00 00 90 64 8b 04 25 18 00 00 00 85 c0 75 14 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 55 c3 0f 1f 40 00 48 83 ec 28 48 89 54 24 18 [ 12.727674] RSP: 002b:00007ffcebb5c398 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 12.727676] RAX: ffffffffffffffda RBX: 0000000000007131 RCX: 00007ff83fec7f93 [ 12.727677] RDX: 0000000000007131 RSI: 00005610fd804a40 RDI: 0000000000000006 [ 12.727678] RBP: 00005610fd804a40 R08: 0000000000007131 R09: 00005610fd802f38 [ 12.727680] R10: fffffffffffffa8a R11: 0000000000000246 R12: 0000000000000000 [ 12.727681] R13: 0000000000000006 R14: 00005610fd7dd490 R15: 0000000000007131 Thanks Amol