Skip to content

Commit 9e75ad5

Browse files
arndbaxboe
authored andcommitted
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 85fae29 commit 9e75ad5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

fs/io_uring.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,15 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
19681968
return 0;
19691969

19701970
if (sig) {
1971-
ret = set_user_sigmask(sig, &ksigmask, &sigsaved, sigsz);
1971+
#ifdef CONFIG_COMPAT
1972+
if (in_compat_syscall())
1973+
ret = set_compat_user_sigmask((const compat_sigset_t __user *)sig,
1974+
&ksigmask, &sigsaved, sigsz);
1975+
else
1976+
#endif
1977+
ret = set_user_sigmask(sig, &ksigmask,
1978+
&sigsaved, sigsz);
1979+
19721980
if (ret)
19731981
return ret;
19741982
}

0 commit comments

Comments
 (0)