From: John Johansen <john.johansen@canonical.com>
To: Amol Grover <frextrite@gmail.com>,
James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Armijn Hemel <armijn@tjaldur.nl>,
Allison Randal <allison@lohutok.net>,
Thomas Gleixner <tglx@linutronix.de>
Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: WARNING: suspicious RCU usage with PROVE_RCU_LIST=y
Date: Mon, 18 May 2020 02:39:19 -0700 [thread overview]
Message-ID: <9bae445f-f971-f638-efa6-d948901843a2@canonical.com> (raw)
In-Reply-To: <20200406114134.GA1010@workstation-kernel-dev>
On 4/6/20 4:41 AM, Amol Grover wrote:
> 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.
>
The comment could be updated to
* Requires: rcu_read_lock be held or the namespace->lock be held.
bascially there are reader paths which take the rcu_read_lock and then call
the __lookupn_profile() helper eg. aa_lookupn_profile() and the writer paths
the hold the ns lock, like in the splat
aa_replace_profiles() takes the ns lock
> [ 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
>
prev parent reply other threads:[~2020-05-18 9:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 11:41 WARNING: suspicious RCU usage with PROVE_RCU_LIST=y Amol Grover
2020-05-14 18:24 ` Amol Grover
2020-05-14 19:38 ` John Johansen
2020-05-18 9:39 ` John Johansen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9bae445f-f971-f638-efa6-d948901843a2@canonical.com \
--to=john.johansen@canonical.com \
--cc=allison@lohutok.net \
--cc=armijn@tjaldur.nl \
--cc=frextrite@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge@hallyn.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).