Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp740701ybl; Wed, 4 Dec 2019 10:05:50 -0800 (PST) X-Google-Smtp-Source: APXvYqywnwXrjG4E0OoK5AoR05vj6Uaoj3ewCcubIe5m5Ndm0CUfn6v8YRaPceJoDLoX4OQ0V/wZ X-Received: by 2002:aca:ed46:: with SMTP id l67mr3620907oih.53.1575482750665; Wed, 04 Dec 2019 10:05:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575482750; cv=none; d=google.com; s=arc-20160816; b=gD/yjIN6t1D4ClZNfhI9TYBnhwdjwq+xVZouHaVAsiSAFmg3WEVns0Fyw5Dt5TGXtb ec3t9EonxUeKeLRCgqwaw3dZi8bUdmQQOVxbA6we+q0rwxxYY23teL1Nd8ktXfHM55uI 5XhdlX8ir4Awa3ZuK6DQeLsEJeXixAtPWxtBIP6+eRjwLXPZ/53/8uM68jiaxJw22ebv qrz/HEaXUx6qEnDSVq8M5hcAxOstIXRk7UODlbDKDKC3bVFB5F5Em/9VjdEjcOj1P00a GuZOUR+zoAEENijF9c8r5bP4cd6TRDB8YB6Lg+HqRtNCSoBLP3zFSvn74vkrIMaSltlo P7cQ== 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=wY6aZ9QVZSLFFbqTBG0/2ylgg2uCXN13BW934dOodTo=; b=PdwvhGUPgAPonkooPdgzpjTplNFBkuvPnatrvgkz9o4r5/6bViYTqf4swl8F9jU2bq DB61jPFMbVKP6ue4+leEre4TRsmWHSzQfbVmUweXv3W41u1IgqPSaCP5MekgfiEk6KSu lQcoJ9gs0WvZ7kTlEttWysYFJ3eWJjO2rEbBNnxtQH7SvNGikqmmpee/m8ch9PtNMBEX rsod8p/jaymjoo71Jg/m/9fY/PRhBvaN8eL/3tfu03SA3Zkj+kvtXkVU2Xsy2AY0hHqJ rQbbLO0IhERM06Xp+cKwgjK06LKjQSFR7N193JeF1h9jfHtiYV6PY03fpmu1R0gI/sJJ Zgsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zgkGA0ke; 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 p129si3503399oig.118.2019.12.04.10.05.37; Wed, 04 Dec 2019 10:05:50 -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=zgkGA0ke; 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 S1730174AbfLDSEU (ORCPT + 99 others); Wed, 4 Dec 2019 13:04:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:48894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729627AbfLDSEE (ORCPT ); Wed, 4 Dec 2019 13:04:04 -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 1B2B1206DF; Wed, 4 Dec 2019 18:04:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482643; bh=hwMKDedI4CD9yAqhIKGCn9TEnS8XMjv6ngS0mRYmE40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zgkGA0keAzo1q/Zj1Zl9nhARIKGC3hrNVQg0eFByFDtrbpjhnnzTtrQ3IiUWgFNXd iirawW5Ll6IcHEeZWtPdFOmTEA4b0YrFBf98n3q4VAFWg5MaOXNCkWqacPTEoNUN73 97ou13pfpcz+FcXZBjo1QRZpItpbTxeruG3nCmks= 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.14 077/209] xfs: Align compat attrlist_by_handle with native implementation. Date: Wed, 4 Dec 2019 18:54:49 +0100 Message-Id: <20191204175326.741230707@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@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 fa0bc4d46065a..d3c0e4b8bf421 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c @@ -347,6 +347,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; @@ -381,6 +382,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