Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2578979ybk; Mon, 18 May 2020 02:41:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRQKUfx7lpnA6Yd9vYgZ3cJt6Dpf6uDPy9f7dxkHxks0PeZSJtYbrqbCfRVJ/AujpdMJNe X-Received: by 2002:aa7:d891:: with SMTP id u17mr4095edq.129.1589794909389; Mon, 18 May 2020 02:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589794909; cv=none; d=google.com; s=arc-20160816; b=g7eL3I0VJYwbWd5kK9fQ3g5t381hihI4MITgsMmKgbIiuIaYDs4AVm5yjmtEShvBnn 4GQl57IvNazVeeFom0/s1GnjSU5QeWIAVlka6PL1CAceoD4wVyyytxEquMSnl7Hiiilu 5c/763OZFkcB49Gutj5kSx9dfQ1ABNCzbsPh1dNlgnG5og4AQQNbOi3tCNYapWw/0ifz saDktLyaVAikBBCJkhpCeVKO0gT+Kx0GIaHe32nw9ki8CCKOG2veblbXyU45ncO864Ah qFckKmuUIxUiRge1X/0jbZghFE6d2yTMzHWcE+AF4xxaBmkAim/1af/bHXq5UughYEte oRwQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:autocrypt:from:references:cc:to:subject; bh=L862G1SQwut4o0cR9/KvDFOffgijhoM2tLnZFyGIBfk=; b=od0JsNchrpUzUaYuvkTe7WQbeBWldH/RuF11sNpNhh+6mWHHGcc6Z1EBwAKVHOzGuV Tv4WhXYigl0zgyJpxA3gvOqlJjA18oVXHM1CQvecLvRNUuUwZn1eNzi9D7T8rAoPMFTp dtoKQDIn5/idPM07AzARuNMW7cvHPaRBMMjcXTUBpIPab2ccaA22cbP2nQ3xkJCNI7qi mxiMCXeQiv7EjKY6/hKhX7dG6JPtNlCuzNP0GNBhtC6FWEV1o0y7ihBd+5ENbX3D8Bot Z1ZiJkLcExJxU2Jm+0g+wqGrZz3JF8wwZMtCIZ/IYXGE7yrdP01sl24wUZFSQUPHS50R JNyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p24si5831737edi.428.2020.05.18.02.41.26; Mon, 18 May 2020 02:41:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726448AbgERJj2 (ORCPT + 99 others); Mon, 18 May 2020 05:39:28 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:54592 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726040AbgERJj2 (ORCPT ); Mon, 18 May 2020 05:39:28 -0400 Received: from static-50-53-45-43.bvtn.or.frontiernet.net ([50.53.45.43] helo=[192.168.192.153]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jacF1-00086E-20; Mon, 18 May 2020 09:39:23 +0000 Subject: Re: WARNING: suspicious RCU usage with PROVE_RCU_LIST=y To: Amol Grover , 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 References: <20200406114134.GA1010@workstation-kernel-dev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ID: <9bae445f-f971-f638-efa6-d948901843a2@canonical.com> Date: Mon, 18 May 2020 02:39:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200406114134.GA1010@workstation-kernel-dev> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >