Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2549079pxj; Mon, 10 May 2021 05:42:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXw6bJnJ3xx/FXvX+wU+8lq29bs8zs+hic8cloR1VGVLDEbhN/FOyj6xTEXWtOCcUXY0n0 X-Received: by 2002:a05:6e02:811:: with SMTP id u17mr20719235ilm.206.1620650541759; Mon, 10 May 2021 05:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620650541; cv=none; d=google.com; s=arc-20160816; b=FS03Iz7GYn2U0yILye8lO+NQAAzwfjSv/lKV9KgfElz+XzBneM2yJDJFp6ERKLRBQN sNq5R6XPba1CcSg9jcM78W6iVAA0Q63ArQRKNkDraCEoTrLAEdwJm9FQSXJZlU41Ssb6 zkp/n8w55/CKL/oq1jLMWSWHPIGT7dcdSQo/5h9Q+Z3YClWLhtjEW6jSgIhny5wdmpTC 0QoMCGhK8fkN4GTnfnV9bsDIqpAMQuc0eyXH2GSYFdvjXklK3xLKF7lVyvA0SVvJ5rL+ cDbPYXtC6vnT5IfQWJSNvypATWaJcuvqULRsKNzMzFhEkfN0erVlvL7MHabeYY5y8/Rd DBFw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GFk3Pu1qOkugpbEzMiEAu0zSTWEsGO2JcegIrC7HKb8=; b=OSGr7LJfAXZ/Bcybx0EYdouOELuyOtjaiywJ12x/S98NnWjWfbexdXi1vo+/69QCqJ WihHbqsol12burbzw1W3oNKEfBW9NxyGPlrTM0zU+beQs+AyXBBpMOIPcWvlRxIuog69 vbUeApbPWTqTe3YbXZ96Y/oIZWe79KgvnlKxuXjOOjsVL88BrkgWk9WzR8JnHpW+nmYq Dxig9bepMH5rI5jDcxKP55k7Gd7g1dRubC+9GfSHQn7twAVV7T1UsWsNBMsM1txhijiE 9rT0gnVDiiWpvqUl7VEa1FWrbmZgdJiKQObQ95dohv+Kf8Nxn4Bnqnvv4S0pKQ1qI1Wv R7Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sHixzjAb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k64si15877690iof.43.2021.05.10.05.42.07; Mon, 10 May 2021 05:42:21 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sHixzjAb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346917AbhEJMdA (ORCPT + 99 others); Mon, 10 May 2021 08:33:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:53306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237326AbhEJLLu (ORCPT ); Mon, 10 May 2021 07:11:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 911A661090; Mon, 10 May 2021 11:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620644947; bh=AoaY9D4d5DiejkuK4ZR7IsJTe2zz79jVdftiA/c3n2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sHixzjAbmpLlgsbEdpGTp2S+eoXq/TjlrgWDOSSVCrritjeA182qbUrWtOuRXnnWQ bU29+QnZdLo5VY8ggW6ZmYJ0oRxxpZMNJQ+Jg2y8RIzxKsaLHBnzzByit7mAx/MbbZ CQvOyllEEsh+Rjox+o41Hm39/DfPH5UJsxuJ+pvM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Theodore Tso Subject: [PATCH 5.12 288/384] fs: fix reporting supported extra file attributes for statx() Date: Mon, 10 May 2021 12:21:17 +0200 Message-Id: <20210510102024.302780283@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102014.849075526@linuxfoundation.org> References: <20210510102014.849075526@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Theodore Ts'o commit 5afa7e8b70d65819245fece61a65fd753b4aae33 upstream. statx(2) notes that any attribute that is not indicated as supported by stx_attributes_mask has no usable value. Commits 801e523796004 ("fs: move generic stat response attr handling to vfs_getattr_nosec") and 712b2698e4c02 ("fs/stat: Define DAX statx attribute") sets STATX_ATTR_AUTOMOUNT and STATX_ATTR_DAX, respectively, without setting stx_attributes_mask, which can cause xfstests generic/532 to fail. Fix this in the same way as commit 1b9598c8fb99 ("xfs: fix reporting supported extra file attributes for statx()") Fixes: 801e523796004 ("fs: move generic stat response attr handling to vfs_getattr_nosec") Fixes: 712b2698e4c02 ("fs/stat: Define DAX statx attribute") Cc: stable@kernel.org Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/stat.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/fs/stat.c +++ b/fs/stat.c @@ -86,12 +86,20 @@ int vfs_getattr_nosec(const struct path /* SB_NOATIME means filesystem supplies dummy atime value */ if (inode->i_sb->s_flags & SB_NOATIME) stat->result_mask &= ~STATX_ATIME; + + /* + * Note: If you add another clause to set an attribute flag, please + * update attributes_mask below. + */ if (IS_AUTOMOUNT(inode)) stat->attributes |= STATX_ATTR_AUTOMOUNT; if (IS_DAX(inode)) stat->attributes |= STATX_ATTR_DAX; + stat->attributes_mask |= (STATX_ATTR_AUTOMOUNT | + STATX_ATTR_DAX); + mnt_userns = mnt_user_ns(path->mnt); if (inode->i_op->getattr) return inode->i_op->getattr(mnt_userns, path, stat,