Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp938280rwe; Thu, 1 Sep 2022 09:48:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR4bx3yoZdVl3QtkbyaBBHJS4OiK9nlqpZca6bMg3X5SJO2ba7CS8B+X4Azh1xumu36p9pd1 X-Received: by 2002:a17:906:9c82:b0:6df:c5f0:d456 with SMTP id fj2-20020a1709069c8200b006dfc5f0d456mr25093395ejc.287.1662050923099; Thu, 01 Sep 2022 09:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662050923; cv=none; d=google.com; s=arc-20160816; b=bkByr1GZsYJ7TXe5IVDeK8RfZdU29bHNPT6P8Yzzk51fgqt+OduiVVfWJ3y2KK9D4N tz6AT5MOALDUcAGu7F8PyHsCpBJxZWFDjMhZGS6/IHQynQzNLgEn+e+pQStgx7wxuLeC cQBjPABCas797YielS2fdCIzY6YowQ5MgUMJ17ZyVk/SoGCOn8r04Z0fLImRHhzZ3dgL Wcg3dled2t6ZwrC+yQweO4p8T6xypS+YjCHrQ7iFolAfoGvdbvSrlPVSrsktXA0WFqEn rmQXItcy5NynJfpGJv5tX9qirXA5IWDFw5FyDZPbm277o7FZMt0gqM8sRLBV9Xmwgk2v nyCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kGC9RvLszX/F52Fly+GHqDOOZPC038OUoGyy20N2fe8=; b=ESFvT3ir2Za72g7sKTi1OiBtXSAcNz2+lXetGh4rZ2rBc5trWrAb09a5jD4KNqNfjz o45WfnLUKUXCi2nUVoL7lbtnsUND2HAbk9TSR2gbdeCoLe22hcKQ4KfJ284BkklickQc Etz0CRNcR3+SvI4gin7tF12BGKNDOhodomsO5KC/cCnw4FwYDlaMIu/mRC46q0aUqT7k /7BEdKIr/3bXf6JZvpwIxkRD5BOH9Lt86PQocd8UFN+bjU1ie1QfsTnocWhQ4AT8QvZa zzKW4xnOKDC8f365YFGIYVVCogusZZ/aMj863cqeiwx97yJhgU20jWag77MNF6zS4UZD Sp4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="F/GvseEq"; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be14-20020a0564021a2e00b00447d3d95e3dsi1840085edb.492.2022.09.01.09.48.17; Thu, 01 Sep 2022 09:48:43 -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=@redhat.com header.s=mimecast20190719 header.b="F/GvseEq"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234596AbiIAP1B (ORCPT + 99 others); Thu, 1 Sep 2022 11:27:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233144AbiIAP0m (ORCPT ); Thu, 1 Sep 2022 11:26:42 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 195E174E38 for ; Thu, 1 Sep 2022 08:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662045996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=kGC9RvLszX/F52Fly+GHqDOOZPC038OUoGyy20N2fe8=; b=F/GvseEq137pZJHZQ7hgUdLt9b3DLURYAa2xAVuvTr+40eODQKQW/W561A+1rPp+5BRpS6 oFcAV/81cdxm8ENb6Bum0HtIK2QplkeiUsFZUfDPXPwMFLHadw17U2ymGLtPsoCDXCxpbi mvxfcFLd3bSosAhZF+HhbH/XXYAI/e0= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-296-k_Sq3I8kObmnvgWCdrH6Ww-1; Thu, 01 Sep 2022 11:26:35 -0400 X-MC-Unique: k_Sq3I8kObmnvgWCdrH6Ww-1 Received: by mail-ej1-f69.google.com with SMTP id jg40-20020a170907972800b0074148cdc7baso6068786ejc.12 for ; Thu, 01 Sep 2022 08:26:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=kGC9RvLszX/F52Fly+GHqDOOZPC038OUoGyy20N2fe8=; b=JuGUHMeP8FTVnyamCettzyBLiQmQq94nHKj1b+tv6FPwnPQSDFLvxrms6VTpxUhpWW wtZ0ncaVus2vwkyzZPqtkxEKsXMUIqz3tXd98Qaoez0F/sbq27ln9tlshWEz7p4r7uCB HPLQqEZBF5JKroPuZzGNFUNkaAquGJFcfwXcTIdI0VYZ/eRgY2pRKU8oKwCmxU4grOX5 iG4ZSOZPZVVStBHa9AfwaBCSXPauhWZDuWfutg2J5NTCZaj1Zj88ehjlg5xKUqzGcP53 afCwdKtQhag51Ar/OhUwc53bdSqlvCbHbwoTLOV1EOO0ZRYYhLPYcgBJOzKn0y9CVUmo ke9g== X-Gm-Message-State: ACgBeo28zGcyzv8J5FyZfIlFjYQYU5tOG/hmwOKUnJydxqv3TTp//y0k XE32ntO6oW7UFxgcrCWBVXmt+1yUFoRHHHi14C3xGUOu6nY+g3l94A8V6ASBtJ/feW5tM5hHWxe HiaaDTArlH/yIBaXXckWdndHo X-Received: by 2002:a17:907:2716:b0:73d:cdf9:b08a with SMTP id w22-20020a170907271600b0073dcdf9b08amr23273243ejk.463.1662045994399; Thu, 01 Sep 2022 08:26:34 -0700 (PDT) X-Received: by 2002:a17:907:2716:b0:73d:cdf9:b08a with SMTP id w22-20020a170907271600b0073dcdf9b08amr23273233ejk.463.1662045994222; Thu, 01 Sep 2022 08:26:34 -0700 (PDT) Received: from localhost.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id o23-20020a170906775700b00730bfe6adc4sm8646031ejn.37.2022.09.01.08.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 08:26:33 -0700 (PDT) From: Ondrej Mosnacek To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, rcu@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Pitt Subject: [PATCH 0/2] fs: fix capable() call in simple_xattr_list() Date: Thu, 1 Sep 2022 17:26:30 +0200 Message-Id: <20220901152632.970018-1-omosnace@redhat.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 The goal of these patches is to avoid calling capable() unconditionally in simple_xattr_list(), which causes issues under SELinux (see explanation in the second patch). The first patch tries to make this change safer by converting simple_xattrs to use the RCU mechanism, so that capable() is not called while the xattrs->lock is held. I didn't find evidence that this is an issue in the current code, but it can't hurt to make that change either way (and it was quite straightforward). Ondrej Mosnacek (2): fs: convert simple_xattrs to RCU list fs: don't call capable() prematurely in simple_xattr_list() fs/xattr.c | 39 +++++++++++++++++++++++---------------- include/linux/xattr.h | 1 + 2 files changed, 24 insertions(+), 16 deletions(-) -- 2.37.2