Re: [tip: x86/entry] x86/entry/32: Use IA32-specific wrappers for syscalls taking 64-bit arguments

From: Jiri Slaby
Date: Wed Jun 10 2020 - 07:29:37 EST


On 21. 03. 20, 16:30, tip-bot2 for Brian Gerst wrote:
> The following commit has been merged into the x86/entry branch of tip:
>
> Commit-ID: 121b32a58a3af89a780cf194ce3769fc4120e574
> Gitweb: https://git.kernel.org/tip/121b32a58a3af89a780cf194ce3769fc4120e574
> Author: Brian Gerst <brgerst@xxxxxxxxx>
> AuthorDate: Fri, 13 Mar 2020 15:51:41 -04:00
> Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> CommitterDate: Sat, 21 Mar 2020 16:03:24 +01:00
>
> x86/entry/32: Use IA32-specific wrappers for syscalls taking 64-bit arguments
>

Hi,

this breaks creation of sparse files (e.g. by tar) on i586 (in 5.7).

tar does this:
> openat(4, "sparsefile", O_WRONLY|O_CREAT|O_EXCL|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC, 0600) = 5
> _llseek(5, 0, [0], SEEK_SET) = 0
> _llseek(5, 8589934592, [8589934592], SEEK_SET) = 0
> write(5, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"..., 512) = 512
> _llseek(5, 8589935104, [8589935104], SEEK_SET) = 0
> _llseek(5, 0, [8589935104], SEEK_CUR) = 0
> ftruncate64(5, 8589935104) = 0
> utimensat_time64(5, NULL, [UTIME_OMIT, {tv_sec=1591782127, tv_nsec=400000000} /* 2020-06-10T11:42:07.400000000+0200 */], 0) = 0
> fchown32(5, 0, 0) = 0
> fchmod(5, 0644) = 0
> close(5) = 0

It should result in a sparsefile of size 8589935104, but after this
commit, it's only 512 bytes.

The archive is this:
XQAAgAD//////////wAXC8aHklo7p4/HJQ64D7SVnhAZOByg5PlRjaTJjmKhpQbF1loXWBYREoWY
DagQFjCR/jUwLV7mWbgHwcINuoi1bu/eDQHOp5mXL9bq/twuolv5Y2krdqZEztWCBydhsNFwBxHi
U47whwTByiH4Ot16JcEkr4BFWXHXMTRs1lfVmIOE13bldiM6MzQUC7212b81Rn13fw06uk+aoP74
OvatxDoW95Y7/xeMyDQ7uk8L1OfFGVRfU+PFycrb1gDZc6hLY2kDY15PGxCMSzHHGDE3nTr9Imdw
UoUYqYNhi3tztLuue2rvzngAsMvHIEJaE6i2E5+X7lwlHZhg9Wp2T9ow9DyaJYLr/N+Jln7P1C97
2hT9YzrPNupujamDoBv0kIA3zgAw/xHvZX/I3tfa5Z8+TjrhfgJ8poGKK1S1e8LR+657FbBH3B46
HZFclvO0bUvL1xyRx0OPM1Dzzd+lH8VgF6RYHj1vDJCcR8nbtEfgN5W+cN44xdPO1VN/6Ffnj5Af
84sDSaBSn7HTnaaJRX0KPa3zfdUzTv/ykgihysjhxAV9CW02ZiVffVgrK5UHVuoWzqQ76+83fYsM
rSWRtoL0a3eo/hbqPvHg1Q8dRvbjwLs610lu3QIkvQ0DOK7zUHx44ODHfLBS2LJcw5TCiU25xGCm
NXS1oRaVdqnCV6Rl5KZHPiHF7ZRxQFQxLgreu8z0INZ41T74pGbfGvNRqyLy9wxiO4/uCICO0om/
oHlgowb9RWX9/0Z2

Feed it through (on i586):
mkdir directory; base64 -d | tar JxvC directory/

and check the size of directory/sparsefile.

Reverting the commit on the top of 5.7 doesn't help. I suppose it
doesn't take the original path in the code there...

Any ideas?

> For the 32-bit syscall interface, 64-bit arguments (loff_t) are passed via
> a pair of 32-bit registers. These register pairs end up in consecutive stack
> slots, which matches the C ABI for 64-bit arguments. But when accessing the
> registers directly from pt_regs, the wrapper needs to manually reassemble the
> 64-bit value. These wrappers already exist for 32-bit compat, so make them
> available to 32-bit native in preparation for enabling pt_regs-based syscalls.
>
> Signed-off-by: Brian Gerst <brgerst@xxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Reviewed-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
> Link: https://lkml.kernel.org/r/20200313195144.164260-16-brgerst@xxxxxxxxx

thanks,
--
js
suse labs