Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1786476rwi; Thu, 3 Nov 2022 09:04:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75d5NzWOAVCrrqlJyl36JVpqXxpRoC90Ppq0UY9rc6pRpFNeFZJ24rO8auw247S8HswPqW X-Received: by 2002:a17:907:9705:b0:7ad:b14f:d89e with SMTP id jg5-20020a170907970500b007adb14fd89emr28531758ejc.745.1667491443278; Thu, 03 Nov 2022 09:04:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667491443; cv=none; d=google.com; s=arc-20160816; b=0NxsqekKTPFXTy2Lx8uYe/S62Lzd0KGrWno9SXBpRropyDn7QJwhA/NMHXSTiRm5Ky YFsqrvwgrHYYxEIeSEcra9iUQvIxNM9wixsJJz8bRIzNIaHPdUK5ktep7UO6f9I3Rg/v Nf9ck5jajmD8QPUI4icCXM/9oZ/s43xXz5I6hXbPPMGxbgqR7MyXeRDBUJcYbjpNGlIQ hOkXJNgQL8JHJ/pSGeiKpdFlnUAFz9oQKeMvvX+uM321O88HFSF5UZnsnzD+dt5M05p7 fcty/fSxD5msejOxjyDcYmoEUlOBffq3lmVDRZcaeZNSf/+aA4IbBPzaupl3gFd9lFrR 6SFQ== 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=BQedccMlG1MsMOeDMp0VPaXRn/vo4LMVEuhsCdhERVY=; b=LyC8izra+OG/OFy6rxhqiqSnjkvOI8g/4n1wJg2K+RxB7cTdftwDar2ICeP0b0sAUW tfGv2CdLd3ElDtll65CKJ0xk+8IEHwMykk1MtW1S/Idp/vKKl1nvizROI9K2jnZJf1gZ JR0j0yMhtBiONT6O8TM5rEMUNSZDHFkM8NbO+sj8/91vAS8qrnoORYrq/pOeoET9XXBe IU6hSBlpRynphqg75SrV6/05H12YLq2fgneARe2gZk8Nw2c6S46sq12nXzlsgszHLWNW Gv4H8Q/3Tu8KneTj2wRRhNDjXG09i6ICjJt3Jet807sHUV3Mp1/NPV5NsE8m5quJP7yX mTxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Uz4RgduU; 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 s19-20020a056402521300b0045d636ca148si1873378edd.575.2022.11.03.09.03.36; Thu, 03 Nov 2022 09:04:03 -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=Uz4RgduU; 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 S232151AbiKCPbc (ORCPT + 97 others); Thu, 3 Nov 2022 11:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232254AbiKCPav (ORCPT ); Thu, 3 Nov 2022 11:30:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26DB21C12F; Thu, 3 Nov 2022 08:30:37 -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 ams.source.kernel.org (Postfix) with ESMTPS id 8A885B828EB; Thu, 3 Nov 2022 15:30:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BD4EC433D6; Thu, 3 Nov 2022 15:30:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667489435; bh=mgyY0R29mGntIOfFVnfmgFP7RctremcB5vzLO4Yx5X0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Uz4RgduU8VABIxZ+tLEpWtmE5xF7WA468KZf1RKzsHa7bo44FeXFGClazxNq/6pba IzEhb2TeVZQ9V5PCjLCl0sVdx7WzYoyzbBIz1kn8lAgPvh3tEiSNpgqfY7hoBR5BsS rSDxUVVWkXxhz4uDaZSfepO3Wt2IiOajTB87+35VPCHEBe7SB0vuWPDlJH46d+B6LW ZDc8duntrmAalwuRUBVfEYl54d+qWrk/FxAid3QI8UFJf3Zo2f/uirz07t25ZIn/U3 UibZs7ViYNB5vkFS7ejmRRjaVEZW3H+q6PDrKzbudrMYx+QYWQDja+e1Sj0ZgkxDDb om9VcqDqdDqFA== Date: Thu, 3 Nov 2022 16:30:30 +0100 From: Christian Brauner To: Ondrej Mosnacek Cc: 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: <20221103153030.ep5rqq2uetpclm3z@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: <20221103151205.702826-1-omosnace@redhat.com> 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 Thu, Nov 03, 2022 at 04:12:05PM +0100, 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 > --- Looks good, Reviewed-by: Christian Brauner (Microsoft)