Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3867548imu; Mon, 7 Jan 2019 10:56:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN6DCtW31FhA+Z7gWwG8t8FHI84Kobl4SzBHE6CqqpjT87iBKOoVjXEjIha+IyRpqsw7S+bL X-Received: by 2002:a63:4c4e:: with SMTP id m14mr12007428pgl.173.1546887372707; Mon, 07 Jan 2019 10:56:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546887372; cv=none; d=google.com; s=arc-20160816; b=qfdsFavDjMlfrTFxnReGVHRKurTH7kfmZEU1RP7/sdZtG2sp7so+ewQN2Zv3cXyV3+ ooQyqQlVf45gobBiVsqdzO+0G7im1ZsxpxHDJcphU2vTNTp35/qM7/pgR4jxuA2cOhzV pGEbwYD2bcF92SF8mXRNy0rb8B1tb+blAbkLvW2r+QzAK33jWtndmCNwG/4obz8lFe7U BTRTw9JS8bFLKQUTi3BNbQT8neAxskbbXzf/dmYN39GIqC6VSbIShwhXpscBOcwKypY+ qN6hsUkXSup5+439Qsm+vuOT9B8/BTsTwdaChc8rcck0Q8l8zncBwZ6t3gGX2U0oaz50 QljA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=s2LBD94hLj5ql9xBoAg9k14arMuYBh89/DHoqGwn6LU=; b=WXf8I/dnr8c8/BGNc8XtWV7gDFHKsedfWU62EmILnwvwueK/Uhn9P9d8sWfj4DTbRy JZmTC0XM4XohOHX23i22a5KZH6tEhZ2Gg7EH61bmbV7DpLvz6DHAO1gAq7Owq4XJaiHW hR20ba7OaDIPF4gxWMon0ZGLr5J2LfAyLH9Qoy4qVqKZ1oEFZe2UTmdiEeB3WZR5zKb+ IQ/vegF+ir0npJj5g2sN5zAv+Eh0V720Cs5KFY5VHHzaAvF32V7zE3cizC3Qb1kno0PL 6UzH5/jMKK5acVcZzX3y+lKagR+Eu2SUp41OVlhoqIj+iIYVvhnwBx4hSxxx4AhNakMV Ee6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=QHkq57RU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh12si60508155plb.353.2019.01.07.10.55.57; Mon, 07 Jan 2019 10:56:12 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=QHkq57RU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728569AbfAGRwn (ORCPT + 99 others); Mon, 7 Jan 2019 12:52:43 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:51160 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728555AbfAGRwm (ORCPT ); Mon, 7 Jan 2019 12:52:42 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x07Hnof5047630; Mon, 7 Jan 2019 17:52:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=s2LBD94hLj5ql9xBoAg9k14arMuYBh89/DHoqGwn6LU=; b=QHkq57RUWb5nj7Ukmg4LnvW4N8D8El4jqu2ytwJCteA0V8XxznMdyr/8+tgD9b/2wCiP WzVkq+1JZBbfOmLN7dN9Bzro+qZvhVdKtOiEnf3GsrAqrX8l3+XGO9a8QBur+ZTGSi/k aB6+bMwLwu+XWjQe3PaeYx1sc1U639zfrOliEVn6Ks+hYt2nUZCYy/GpdYyWs7b8TsrJ knH/uR8zczCJmpP7eGyVirQYnjKlZsqu0MFLEvQVjtAytNupPYvXXz2+oCkBXQwX+RN8 qizbaf8m1iFFqT0QS6+K0HGPrEpAsGEJjFooskZnn8pWaMwrb9nIfAWLgMWZ0IL3okz8 lw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2ptj3dqdvp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 07 Jan 2019 17:52:37 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x07HqUVK014886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Jan 2019 17:52:31 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x07HqU26008758; Mon, 7 Jan 2019 17:52:30 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 Jan 2019 09:52:30 -0800 Date: Mon, 7 Jan 2019 09:52:29 -0800 From: "Darrick J. Wong" To: Su Yanjun Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, suyanjun218@gmail.com Subject: Re: [PATCH] xfs: correct statx's result_mask value Message-ID: <20190107175229.GJ12689@magnolia> References: <1546854790-5233-1-git-send-email-suyj.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1546854790-5233-1-git-send-email-suyj.fnst@cn.fujitsu.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9129 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=939 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901070152 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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... ...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? --D > > if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE) > stat->attributes |= STATX_ATTR_IMMUTABLE; > -- > 2.7.4 > > >