]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
xfs: Fix bulkstat compat ioctls on x32 userspace.
authorNick Bowler <nbowler@draconx.ca>
Mon, 17 Dec 2018 17:35:27 +0000 (09:35 -0800)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:21:31 +0000 (14:21 -0300)
commit352d637a8c99f4212523a8e46a86824fc5b7ebd6
tree104bcd301aae77cf4aa129d20b375082a7113f84
parent8fd9afba0caa0dd2b270485d373d805cc0965745
xfs: Fix bulkstat compat ioctls on x32 userspace.

BugLink: https://bugs.launchpad.net/bugs/1855787
[ Upstream commit 7ca860e3c1a74ad6bd8949364073ef1044cad758 ]

The bulkstat family of ioctls are problematic on x32, because there is
a mixup of native 32-bit and 64-bit conventions.  The xfs_fsop_bulkreq
struct contains pointers and 32-bit integers so that matches the native
32-bit layout, and that means the ioctl implementation goes into the
regular compat path on x32.

However, the 'ubuffer' member of that struct in turn refers to either
struct xfs_inogrp or xfs_bstat (or an array of these).  On x32, those
structures match the native 64-bit layout.  The compat implementation
writes out the 32-bit version of these structures.  This is not the
expected format for x32 userspace, causing problems.

Fortunately the functions which actually output these xfs_inogrp and
xfs_bstat structures have an easy way to select which output format
is required, so we just need a little tweak to select the right format
on x32.

Signed-off-by: Nick Bowler <nbowler@draconx.ca>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/xfs/xfs_ioctl32.c