Fix 64-bit syscall argument fetching in 32-bit Linux syscall handlers.
authormarkj <markj@FreeBSD.org>
Tue, 21 Jan 2020 17:28:22 +0000 (17:28 +0000)
committermarkj <markj@FreeBSD.org>
Tue, 21 Jan 2020 17:28:22 +0000 (17:28 +0000)
commit293becab6beff84a6495641cb82ed6d4e2fac509
tree7923c45cdfd703e331062aeb9de9247d94864748
parent05386e4d1f3d2a0f722479113fa59242ab1de700
Fix 64-bit syscall argument fetching in 32-bit Linux syscall handlers.

The Linux32 system call argument fetcher places each argument (passed in
registers in the Linux x86 system call convention) into an entry in the
generic system call args array.  Each member of this array is 8 bytes
wide, so this approach is broken for system calls that take off_t
arguments.

Fix the problem by splitting l_loff_t arguments in the 32-bit system
call descriptions, the same as we do for FreeBSD32.  Change entry points
to handle this using the PAIR32TO64 macro.

Move linux_ftruncate64() into compat/linux.

PR: 243155
Reported by: Alex S <iwtcex@gmail.com>
Reviewed by: kib (previous version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23210
sys/amd64/linux32/linux32_machdep.c
sys/amd64/linux32/syscalls.master
sys/compat/linux/linux_file.c
sys/i386/linux/linux_machdep.c