linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] io_uring: fix big-endian compat signal mask handling
@ 2019-03-25 14:34 Arnd Bergmann
  2019-03-25 16:05 ` Jens Axboe
  2019-03-25 16:19 ` James Bottomley
  0 siblings, 2 replies; 9+ messages in thread
From: Arnd Bergmann @ 2019-03-25 14:34 UTC (permalink / raw)
  To: Andrew Morton, Jens Axboe
  Cc: Arnd Bergmann, Alexander Viro, Hannes Reinecke, Matthew Wilcox,
	David Hildenbrand, Nikolay Borisov, linux-block, linux-fsdevel,
	linux-kernel

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>
---
 fs/io_uring.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 6aaa30580a2b..8f48d29abf76 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -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;
 	}
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-03-26  8:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25 14:34 [PATCH 1/2] io_uring: fix big-endian compat signal mask handling Arnd Bergmann
2019-03-25 16:05 ` Jens Axboe
2019-03-25 16:11   ` Arnd Bergmann
2019-03-25 16:15     ` Jens Axboe
2019-03-25 16:19 ` James Bottomley
2019-03-25 16:23   ` Jens Axboe
2019-03-25 16:24   ` Arnd Bergmann
2019-03-26  0:13     ` James Bottomley
2019-03-26  8:35       ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).