io_uring: fix big-endian compat signal mask handling

On big-endian architectures, the signal masks are differnet
between 32-bit and 64-bit tasks, so we have to use a different
function for reading them from user space.

io_cqring_wait() initially got this wrong, and always interprets
this as a native structure. This is ok on x86 and most arm64,
but not on s390, ppc64be, mips64be, sparc64 and parisc.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Arnd Bergmann 2019-03-25 15:34:53 +01:00 committed by Jens Axboe
parent 85fae294e1
commit 9e75ad5d8f
1 changed files with 9 additions and 1 deletions

View File

@ -1968,7 +1968,15 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
return 0;
if (sig) {
ret = set_user_sigmask(sig, &ksigmask, &sigsaved, sigsz);
#ifdef CONFIG_COMPAT
if (in_compat_syscall())
ret = set_compat_user_sigmask((const compat_sigset_t __user *)sig,
&ksigmask, &sigsaved, sigsz);
else
#endif
ret = set_user_sigmask(sig, &ksigmask,
&sigsaved, sigsz);
if (ret)
return ret;
}