Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp756381ybl; Wed, 4 Dec 2019 10:19:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwU5T8x369pEUL7qMwcKKh0teU0kkEdvgB3bIjovEXIL26Xk4fH2hDCaXjLUIHNBflG8BJE X-Received: by 2002:a05:6808:618:: with SMTP id y24mr3636883oih.86.1575483579995; Wed, 04 Dec 2019 10:19:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575483579; cv=none; d=google.com; s=arc-20160816; b=Cd8FprBU8nwIDdpv96X7TR74ChglLVqOJ07J7+7wF91KAc/Fep0omeYDBaPGTtLdxy Z4Dwb2lUIoC3IEFEBvNiFut7XoC439QVBgj4u/Akxray/cEv1Sj54gs83PxdKCRqO0gk 7Zy4Kkq4msTx8ac1aBonLAre0o0lfyBKq8vFmRXVj43LTjKbKTGI/K8uO5DS5H28IU2G 106pzzDZy2Pdiv+e/EsWwI+EVUf5gM5p30i+iPEPPmzU/OafdFgS3gCCWo72eCMRrGFv vHcJavTnB2PKOr6bpSv4jOZvW4fFdAGefUvQHA/ktmOOzHNm48yPBLiXzd2zPCvJYBOC 9AJQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uumUDoAua7qyIlM5GtJgr+bgfy1cU4bPyaZ3hVuYLL4=; b=QGP3Pxt0NmZjQQiUAo2gKpT6TMK5N96zRa49jjlv8SXipQNXm4uwOUFuZBPr20K/Io vk92A2KMekGklUZ+Zb9rHA8Ur4MZab5ilEkZ8AjIIT4S4Z2pAlELqPuOrLqKddeXy3hs c/a963a32Gzy4t0OMDPn96mkEXr+pImRUCxCBcozX5MVkMeKh+KndUTjIFucW4sHGMpe tedXVFobahLv0Kl5A6NFD5d+vrOMYc2iXuUiOgexwYtqH7IcuV4FoWJ9CZJb57HtR5gi EJyCH6LPVBI/pEPrA64fvKlNGkdSCQqWmpHVwDNS/stI+tNK/hYXLhHT/xZ6wWENppCm RzVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rjAkDddW; 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 m19si2230230oig.91.2019.12.04.10.19.27; Wed, 04 Dec 2019 10:19:39 -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=@kernel.org header.s=default header.b=rjAkDddW; 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 S1731444AbfLDSL3 (ORCPT + 99 others); Wed, 4 Dec 2019 13:11:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:39642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731440AbfLDSL1 (ORCPT ); Wed, 4 Dec 2019 13:11:27 -0500 Received: from localhost (unknown [217.68.49.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 447432089C; Wed, 4 Dec 2019 18:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575483086; bh=bd+l4JctyoeYXCZJ2Dfc0BfpyirtBreCT9vLJuWcGOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rjAkDddWKbBZKSztYunsL3NkbmvQzbBsrvnWNi7T+M8kZfp/QSP7mRuEmP/LiJHif 1o1ddUmZv/5bCOHDvV0Oz8kR//CJSDCxyHeFK6xj5J4CLvPLPSU1HJut6Anv/MDNxg AlLw8vc2Edi06WRwzMsrKohkNWQXiVbfru9oXizQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Bowler , "Darrick J. Wong" , Sasha Levin Subject: [PATCH 4.9 047/125] xfs: Align compat attrlist_by_handle with native implementation. Date: Wed, 4 Dec 2019 18:55:52 +0100 Message-Id: <20191204175321.829538950@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175308.377746305@linuxfoundation.org> References: <20191204175308.377746305@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nick Bowler [ Upstream commit c456d64449efe37da50832b63d91652a85ea1d20 ] While inspecting the ioctl implementations, I noticed that the compat implementation of XFS_IOC_ATTRLIST_BY_HANDLE does not do exactly the same thing as the native implementation. Specifically, the "cursor" does not appear to be written out to userspace on the compat path, like it is on the native path. This adjusts the compat implementation to copy out the cursor just like the native implementation does. The attrlist cursor does not require any special compat handling. This fixes xfstests xfs/269 on both IA-32 and x32 userspace, when running on an amd64 kernel. Signed-off-by: Nick Bowler Fixes: 0facef7fb053b ("xfs: in _attrlist_by_handle, copy the cursor back to userspace") Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Sasha Levin --- fs/xfs/xfs_ioctl32.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index 321f57721b922..8f18756ee405e 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c @@ -346,6 +346,7 @@ xfs_compat_attrlist_by_handle( { int error; attrlist_cursor_kern_t *cursor; + compat_xfs_fsop_attrlist_handlereq_t __user *p = arg; compat_xfs_fsop_attrlist_handlereq_t al_hreq; struct dentry *dentry; char *kbuf; @@ -380,6 +381,11 @@ xfs_compat_attrlist_by_handle( if (error) goto out_kfree; + if (copy_to_user(&p->pos, cursor, sizeof(attrlist_cursor_kern_t))) { + error = -EFAULT; + goto out_kfree; + } + if (copy_to_user(compat_ptr(al_hreq.buffer), kbuf, al_hreq.buflen)) error = -EFAULT; -- 2.20.1