public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH for-next 1/1] io_uring: limit registration w/ SINGLE_ISSUER
@ 2022-09-27  0:13 Pavel Begunkov
  2022-09-27  0:43 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2022-09-27  0:13 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

IORING_SETUP_SINGLE_ISSUER restricts what tasks can submit requests.
Extend it to registration as well, so non-owning task can't do
registrations. It's not necessary at the moment but might be useful in
the future.

Cc: <[email protected]> # 6.0
Fixes: 97bbdc06a444 ("io_uring: add IORING_SETUP_SINGLE_ISSUER")
Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/io_uring.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 73ac6948debb..3f6eb3cf07ac 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3890,6 +3890,9 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
 	if (WARN_ON_ONCE(percpu_ref_is_dying(&ctx->refs)))
 		return -ENXIO;
 
+	if (ctx->submitter_task && ctx->submitter_task != current)
+		return -EEXIST;
+
 	if (ctx->restricted) {
 		if (opcode >= IORING_REGISTER_LAST)
 			return -EINVAL;
-- 
2.37.2


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

* Re: [PATCH for-next 1/1] io_uring: limit registration w/ SINGLE_ISSUER
  2022-09-27  0:13 [PATCH for-next 1/1] io_uring: limit registration w/ SINGLE_ISSUER Pavel Begunkov
@ 2022-09-27  0:43 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2022-09-27  0:43 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On Tue, 27 Sep 2022 01:13:30 +0100, Pavel Begunkov wrote:
> IORING_SETUP_SINGLE_ISSUER restricts what tasks can submit requests.
> Extend it to registration as well, so non-owning task can't do
> registrations. It's not necessary at the moment but might be useful in
> the future.
> 
> 

Applied, thanks!

[1/1] io_uring: limit registration w/ SINGLE_ISSUER
      commit: 567a9ba00f144a1d2ec291e5188043c2db8c2b77

Best regards,
-- 
Jens Axboe



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

end of thread, other threads:[~2022-09-27  0:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-27  0:13 [PATCH for-next 1/1] io_uring: limit registration w/ SINGLE_ISSUER Pavel Begunkov
2022-09-27  0:43 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox