Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4330384imu; Mon, 7 Jan 2019 21:09:16 -0800 (PST) X-Google-Smtp-Source: ALg8bN6rKOsZmfPWAyk6bAZZh8phpiGPBd4n1Errmq5IvZlGxJ9qMWcI05IJMd8rqUQ/KIiORAxB X-Received: by 2002:a17:902:e10a:: with SMTP id cc10mr337815plb.165.1546924156531; Mon, 07 Jan 2019 21:09:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546924156; cv=none; d=google.com; s=arc-20160816; b=scqaO83g4KwDFr/fH1C4lOClein6304IPaZAXOXWgTyX9r885Y8ytLYSs0+Yc67hPo gnP092NM8kfdpdbqgRQdCPQnxjRQAuPm+w6ijaUTraR3smdGAPGHqDko0XeLJe1fxNDX 3AEtrH4hKfVQ4EZMxN4Hhsdhdgjnz5i49sn3owEhVF4HjAwsYfFiLOEYTpGIneUY1eHN Svx1hsehdNI4wezcdxU5B/+MJ7bQ2UPtCl8mndJEXnB90s+2aQrze5t8u8LnyTjSAK4O DKk7ClGgzUSSZDuOKWgWE9fEBu0kk9TdDfjWaDRXXNvKZ0/mZOZwrD4gQzbvHSSIG/C/ BKPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:references:cc:to:subject :from; bh=SEGaf5fU7ou0vV0GuhF+vOpGWzO0DYUHNwqOUzupcpY=; b=Jdy7j+0Dxnk8tXTIniJITyRL8dXsJcV94uzkjbfkftSdaacj2Abv4ZqbPnd+EVbvPS Vk5cAdVLW4AM7bpAkEH6oCzc+COsCeye2M9ySM8fMqWJz2g0xYTL6Tl+d02s/c27QVGr j9U52vEdPGVfMdjxk9APGP+0l5n6t8OLQMRhhAbfbz+W+E/OEWk5oyjq/kIhi+t+8Iel zbPbrOI2kAV0VefjNdDW9h0Py89mHxzOVKK2BvHAlEjDqTX32frJHNee9JG4InYMrOUT BYO1ZmHqSK0YVaWrELphD5+S2R4O04lqgIY0FoqBfqK6acP9I7f7IAHfRXBRxIQ7H8Np gEkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si11813421plr.204.2019.01.07.21.08.59; Mon, 07 Jan 2019 21:09:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727637AbfAHE6t (ORCPT + 99 others); Mon, 7 Jan 2019 23:58:49 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:32333 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727290AbfAHE6t (ORCPT ); Mon, 7 Jan 2019 23:58:49 -0500 X-IronPort-AV: E=Sophos;i="5.56,452,1539619200"; d="scan'208";a="51528889" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 08 Jan 2019 12:58:47 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 79FA54BAC81F; Tue, 8 Jan 2019 12:58:47 +0800 (CST) Received: from [10.167.225.53] (10.167.225.53) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 8 Jan 2019 12:58:45 +0800 From: "Su Yanjun " Subject: Re: [PATCH] xfs: correct statx's result_mask value To: Eric Sandeen , "Darrick J. Wong" CC: , , References: <1546854790-5233-1-git-send-email-suyj.fnst@cn.fujitsu.com> <20190107175229.GJ12689@magnolia> <2b27e2ec-368b-d24c-8443-e265f87e417c@sandeen.net> Message-ID: <67e03af1-6e11-4236-76e6-6127b6cfb9b9@cn.fujitsu.com> Date: Tue, 8 Jan 2019 12:58:43 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <2b27e2ec-368b-d24c-8443-e265f87e417c@sandeen.net> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.167.225.53] X-yoursite-MailScanner-ID: 79FA54BAC81F.AD36C X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: suyj.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/8/2019 2:04 AM, Eric Sandeen wrote: > On 1/7/19 11:52 AM, Darrick J. Wong wrote: >> On Mon, Jan 07, 2019 at 04:53:10AM -0500, Su Yanjun wrote: >>> For statx syscall, xfs return the wrong result_mask. >>> >>> Signed-off-by: Su Yanjun >>> --- >>> fs/xfs/xfs_iops.c | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c >>> index f48ffd7..3811457 100644 >>> --- a/fs/xfs/xfs_iops.c >>> +++ b/fs/xfs/xfs_iops.c >>> @@ -521,6 +521,9 @@ xfs_vn_getattr( >>> stat->btime.tv_nsec = ip->i_d.di_crtime.t_nsec; >>> } >>> } >>> + >>> + /* Only return mask that we care */ >>> + stat->result_mask &= request_mask; >> Why not just: >> >> stat->result_mask = STATX_BASIC_STATS; >> >> at the top of the function? >> >> I don't see the need to mask off result_mask at all, since we could some >> day elect to return more than what's in request_mask... When we run xfstests with nfs, the generic/423 case runs failed. So i review the nfs' nfs_getattr code it does validate the request_mask. Then i review the xfs' getattr code, it has no such check. Whatever request_mask  is set, the stat's result_mask always the 0x7ff. Maybe it has Unclear semantics about statx's result_mask. >> ...waitaminute, are you seeing garbage in the result_mask that's >> returned to userspace? I also noticed the vfs stat functions declare >> "struct kstat stat;" without explicitly zeroing the structure fields, >> which means (I think) that we can leak stack information if the kernel >> isn't built with the stackleak plugin? No such problem. > A clear problem statement and reproducer steps would be hugely useful > here. > > -Eric Thanks, Su