From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67D9AC433E0 for ; Thu, 18 Mar 2021 18:19:39 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8707564F1D for ; Thu, 18 Mar 2021 18:19:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8707564F1D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=paul-moore.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=linux-audit-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-248-kr8wfYsxMw2th1vvT69SVw-1; Thu, 18 Mar 2021 14:19:30 -0400 X-MC-Unique: kr8wfYsxMw2th1vvT69SVw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 973DA83DD21; Thu, 18 Mar 2021 18:19:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 59FCF10016F8; Thu, 18 Mar 2021 18:19:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 745081809C83; Thu, 18 Mar 2021 18:19:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12IIJOYV016315 for ; Thu, 18 Mar 2021 14:19:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4852F2166B44; Thu, 18 Mar 2021 18:19:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4259A2166BA3 for ; Thu, 18 Mar 2021 18:19:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9FE60181B7A2 for ; Thu, 18 Mar 2021 18:19:21 +0000 (UTC) Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-552-mFqW3bvZPW285CTkwk4VrQ-1; Thu, 18 Mar 2021 14:19:19 -0400 X-MC-Unique: mFqW3bvZPW285CTkwk4VrQ-1 Received: by mail-ej1-f54.google.com with SMTP id r12so5454296ejr.5 for ; Thu, 18 Mar 2021 11:19:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7sse64bqIOWwkx9kqYUy4ajU7Bzc2Pb4HNGntqpA0mM=; b=X84hltShM8B20Z2La6ArJ7oltA3RsZaBsfP9zcmnm21EoeakKHmHDymDZhz+r/zUhS c+HBqlSQFicRqbiAsSeogHtZiJ7eEL7uysfk1owPr3i0uc0IimXNr/CNr3X7lmDgV4E1 XkxAuqF4AAN5PjhSjy/A18vExkiz+X0Ae7KMfN9y3ddr0G9NYTr4iaWPRNWofC/tNF22 /WBh2l0kLghUV0v6bE1yJZf69+7GS2FgxTNPk8Pm/mQC7zFvJc1eL/VcWHKdn7qpmgdJ FOZyBkDJDzKiaZSXeOq4grqbALTIiDzEYBNtCkF2PBCD5yPjVdIkvqy2LOKJK2UvsOo0 TkMw== X-Gm-Message-State: AOAM532HQro4SUr58hmS8zSxcbxcsfS+3/lPOd5d/EGV5igFrlKOcTqR XcVy3poMrqb3zlwKRfPJOUqQ1nWuLIVUrnzVsDPT X-Google-Smtp-Source: ABdhPJz3ZhyPn56X7wMia/HfV+uHSUf5OdJlPqCXRQwY+sZNLIXnrBAWLfGC9myUp3XOXqFIONy9n0/+0d2i9slNCo0= X-Received: by 2002:a17:906:3d62:: with SMTP id r2mr41708535ejf.488.1616091557890; Thu, 18 Mar 2021 11:19:17 -0700 (PDT) MIME-Version: 1.0 References: <2ed7a55e-7def-7faf-fc47-991b867bff9e@iogearbox.net> <1e410caf-019a-ade7-465d-3d936d2f7dc6@iogearbox.net> <5845cef9-5aaf-f85e-8280-472f61ddaeed@iogearbox.net> <61494cfb-1ceb-4886-3023-1ac0b35697d6@iogearbox.net> In-Reply-To: From: Paul Moore Date: Thu, 18 Mar 2021 14:19:05 -0400 Message-ID: Subject: Re: deadlock bug related to bpf,audit subsystems To: Serhei Makarov X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: linux-audit@redhat.com Cc: linux-security-module@vger.kernel.org, Jerome Marchand , Daniel Borkmann , selinux@vger.kernel.org, ast@kernel.org, Frank Eigler , linux-audit@redhat.com, bpf@vger.kernel.org, Jiri Olsa , guro@fb.com X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=linux-audit-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Thu, Mar 18, 2021 at 1:45 PM Paul Moore wrote: > On Thu, Mar 18, 2021 at 1:44 PM Paul Moore wrote: > > On Thu, Mar 18, 2021 at 12:57 PM Serhei Makarov wrote: > > > On Thu, Mar 18, 2021 at 10:43 AM Serhei Makarov wrote: > > > > Jiri Olsa also reports seeing a similar deadlock at v5.10. I'm in the > > > > middle of double-checking my bisection which ended up at a > > > > seemingly-unrelated commit [2] > > > > > > > > [1] https://bugzilla.redhat.com/show_bug.cgi?id=1938312 > > > > [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.11-rc7&id=2dcb3964544177c51853a210b6ad400de78ef17d > > > > > > I've confirmed that my first bisection was incorrect by testing > > > @1c2f67308af4 mm: thp: fix MADV_REMOVE deadlock on shmem THP > > > and reproducing the deadlock. Previously this commit was marked as > > > good, so it seems a kernel with the bug can sometimes pass the test. > > > > > > I'll double check rc6 next since I have the kernel handy. If > > > 5.11.0-rc6 can also be made to fail, with Jiri Olsa's report it'd be > > > necessary to do a wider search. > > > There may be commits with intent similar to > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8d92db5c04d103 > > > which tightened some of the behaviour of kernel reads, but affecting > > > the audit subsystem? > > > The actual stack trace that leads to deadlock goes through > > > security_locked_down() which was present since the original patch > > > reworking probe_read into separate probe_read_{user,kernel} helpers > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.11-rc7&id=6ae08ae3dea2 > > > > Added thee SELinux list to the To/CC line; they should really be > > involved. I'm also CC'ing the LSM list for good measure as there may > > be other people that care about this. > > Argh, hit send a bit too quickly :/ > > > FYI, the first instance of this thread that I saw can be found here > > via the linux-audit list: > > > > https://lore.kernel.org/linux-audit/CANYvDQN7H5tVp47fbYcRasv4XF07eUbsDwT_eDCHXJUj43J7jQ@mail.gmail.com/ Previously in the thread there was a question about why audit events are being generated inside bpf_probe_read_compat(); the answer is pretty simple, we do an access check in the security_locked_down() hook, inside the call to bpf_probe_read_kernel_common(), and that can result in an audit event depending on the LSM and it's policy. Skipping the audit event in the case of a LSM access denial, e.g. a SELinux AVC denial, could result in a silent access denial which can be maddening both to users and admins. -- paul moore www.paul-moore.com -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit