* [PATCH] fix breakage in SOCKET_URING_OP_SIOC* implementation
@ 2023-12-14 21:34 Al Viro
2023-12-14 23:53 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Al Viro @ 2023-12-14 21:34 UTC (permalink / raw)
To: Jens Axboe; +Cc: Breno Leitao, Jakub Kicinski, io-uring, linux-kernel, netdev
In 8e9fad0e70b7 "io_uring: Add io_uring command support for sockets"
you've got an include of asm-generic/ioctls.h done in io_uring/uring_cmd.c.
That had been done for the sake of this chunk -
+ ret = prot->ioctl(sk, SIOCINQ, &arg);
+ if (ret)
+ return ret;
+ return arg;
+ case SOCKET_URING_OP_SIOCOUTQ:
+ ret = prot->ioctl(sk, SIOCOUTQ, &arg);
SIOC{IN,OUT}Q are defined to symbols (FIONREAD and TIOCOUTQ) that come from
ioctls.h, all right, but the values vary by the architecture.
FIONREAD is
0x467F on mips
0x4004667F on alpha, powerpc and sparc
0x8004667F on sh and xtensa
0x541B everywhere else
TIOCOUTQ is
0x7472 on mips
0x40047473 on alpha, powerpc and sparc
0x80047473 on sh and xtensa
0x5411 everywhere else
->ioctl() expects the same values it would've gotten from userland; all
places where we compare with SIOC{IN,OUT}Q are using asm/ioctls.h, so
they pick the correct values. io_uring_cmd_sock(), OTOH, ends up
passing the default ones.
Fixes: 8e9fad0e70b7 ("io_uring: Add io_uring command support for sockets")
Cc: [email protected]
Signed-off-by: Al Viro <[email protected]>
---
diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index acbc2924ecd2..7d3ef62e620a 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -7,7 +7,7 @@
#include <linux/nospec.h>
#include <uapi/linux/io_uring.h>
-#include <uapi/asm-generic/ioctls.h>
+#include <asm/ioctls.h>
#include "io_uring.h"
#include "rsrc.h"
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fix breakage in SOCKET_URING_OP_SIOC* implementation
2023-12-14 21:34 [PATCH] fix breakage in SOCKET_URING_OP_SIOC* implementation Al Viro
@ 2023-12-14 23:53 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2023-12-14 23:53 UTC (permalink / raw)
To: Al Viro; +Cc: Breno Leitao, Jakub Kicinski, io-uring, linux-kernel, netdev
On Thu, 14 Dec 2023 21:34:08 +0000, Al Viro wrote:
> In 8e9fad0e70b7 "io_uring: Add io_uring command support for sockets"
> you've got an include of asm-generic/ioctls.h done in io_uring/uring_cmd.c.
> That had been done for the sake of this chunk -
> + ret = prot->ioctl(sk, SIOCINQ, &arg);
> + if (ret)
> + return ret;
> + return arg;
> + case SOCKET_URING_OP_SIOCOUTQ:
> + ret = prot->ioctl(sk, SIOCOUTQ, &arg);
>
> [...]
Applied, thanks!
[1/1] fix breakage in SOCKET_URING_OP_SIOC* implementation
commit: 1ba0e9d69b2000e95267c888cbfa91d823388d47
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-14 23:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-14 21:34 [PATCH] fix breakage in SOCKET_URING_OP_SIOC* implementation Al Viro
2023-12-14 23:53 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox