Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp2280780rwl; Sat, 5 Nov 2022 04:54:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Qz128V5E8/TMHK3cy/H5BeoY+wqpHOygDj9Hqy7oWJxhJJ4+LryaHUkyndu110Wb3zGj0 X-Received: by 2002:a17:903:244e:b0:186:c41e:ce9e with SMTP id l14-20020a170903244e00b00186c41ece9emr41244939pls.100.1667649272108; Sat, 05 Nov 2022 04:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667649272; cv=none; d=google.com; s=arc-20160816; b=BYVaeX5xBR6KCbc7+17D3iQIHwU54qH9ibbMF/zbGcLyTPPibimFoOywpfLb7mSP8r KGIZBSlDeo6km//LUbarhP+LkA6W6hecqm7AQZRNhMTACH+1l1ztIJZL5XazcA6WdhpU 6q0ccfExHiuGbMDoqqjUkIWzMhZgmr80tRMKqgvPBkUfb2rHTCS0vNgTu3BMfdRDwCGp xawUfGSYYdcfMIaIcljff8fwkIGjVQb6+l4CFVxKfV+m6VagZWQXeXgeCZD71tvIK7R3 as60/Xb/YEbfZ0JKqdP3qOLO9dtmw4/A3fR/JFx/iutqq0knDfsqEOzCsJNDf4gOZKmk kc/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=uD5O0KkzawzDejNlTVvFz/WdwhgQ7LbQvmRYZ84jDGY=; b=f7eOsVECJyabAx23W0YiHxEqkihniCu56ZkL1VRQWAhyFErxcS0Ja8E0V/sxUa75Ke SnVnM8Lc4WQ9IHzSzLi6SbCm+Batjn5nkSyK4+kJSSyZWH10ucSE/4/zFaD8mf089tgG 3R8pF1zWYUUWnu+I27UyDovv/7iIRU6O4+nHcOFiVZJH48RnXpDuixbylMu4sGFT8uI7 uPC14r//qWDEra6E2EDSSlfApS/kCUg5VvgafsGYlO6DRglg6d31Itz5bGJRqYGMTQG+ cI31oR+i/MYO4sgAstdM+jN17HPssPei8dyZOzFICsyXZScXvBbpQ7xVDbBstQu6c/A3 dOjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ge1IBemh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay1-20020a1709028b8100b00187204e13fcsi2612888plb.516.2022.11.05.04.54.19; Sat, 05 Nov 2022 04:54:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ge1IBemh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229607AbiKELeX (ORCPT + 97 others); Sat, 5 Nov 2022 07:34:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbiKELeU (ORCPT ); Sat, 5 Nov 2022 07:34:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DADB71C920; Sat, 5 Nov 2022 04:34:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 605AA6090C; Sat, 5 Nov 2022 11:34:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC2C0C433C1; Sat, 5 Nov 2022 11:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667648058; bh=aPsJ3tPFbBeVu0/xlG/SDWoFVAR10XjI3Pny8nFp4Zg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ge1IBemhCv5y08Wrwf4NxCP6bAOsPR9ni3XQewsRVIwYdWi6elB1rVNo5SeQi+1zB rdEFlB4/2hxMSxuxwKlmfzBEx/b2J6bQY48QIatyALeY/PbEBaHPwWk129YwpoOAng ayv9fDqouoMW/qGUv5yWI+Rl7jh91XAz1XMdovXCPm9l1WGQhclND/dUYU3xfjAO2+ jTQuYbEffCX1uewcyGJreNWvKtsdn3mC9d3SKGd6pKtkwxy77vN4KvalV2SDxFq0A3 1Z6i7Lzl3vz2AQWE813ydHwy/X0pm6BHbe9FkGftrzlYGqqDlOD1Ialy3xcxSW0Y09 63ibkXBdWCbBg== Date: Sat, 5 Nov 2022 12:34:13 +0100 From: Christian Brauner To: Paul Moore Cc: Ondrej Mosnacek , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Pitt Subject: Re: [PATCH v2] fs: don't audit the capability check in simple_xattr_list() Message-ID: <20221105113413.lzgwdlcobmliq32b@wittgenstein> References: <20221103151205.702826-1-omosnace@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 05, 2022 at 12:38:57AM -0400, Paul Moore wrote: > On Thu, Nov 3, 2022 at 11:13 AM Ondrej Mosnacek wrote: > > > > The check being unconditional may lead to unwanted denials reported by > > LSMs when a process has the capability granted by DAC, but denied by an > > LSM. In the case of SELinux such denials are a problem, since they can't > > be effectively filtered out via the policy and when not silenced, they > > produce noise that may hide a true problem or an attack. > > > > Checking for the capability only if any trusted xattr is actually > > present wouldn't really address the issue, since calling listxattr(2) on > > such node on its own doesn't indicate an explicit attempt to see the > > trusted xattrs. Additionally, it could potentially leak the presence of > > trusted xattrs to an unprivileged user if they can check for the denials > > (e.g. through dmesg). > > > > Therefore, it's best (and simplest) to keep the check unconditional and > > instead use ns_capable_noaudit() that will silence any associated LSM > > denials. > > > > Fixes: 38f38657444d ("xattr: extract simple_xattr code from tmpfs") > > Reported-by: Martin Pitt > > Suggested-by: Christian Brauner (Microsoft) > > Signed-off-by: Ondrej Mosnacek > > --- > > > > v1 -> v2: switch to simpler and better solution as suggested by Christian > > > > v1: https://lore.kernel.org/selinux/CAFqZXNuC7c0Ukx_okYZ7rsKycQY5P1zpMPmmq_T5Qyzbg-x7yQ@mail.gmail.com/T/ > > > > fs/xattr.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > VFS folks, this should really go through a vfs tree, but if nobody > wants to pick it up *and* there are no objections to the change, I can > take this via the LSM tree. I can pick this up as I'm currently massaging the simple xattr infrastructure. I think the fix is pretty straightforward otherwise. Christian