public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jeff Xu <[email protected]>
To: [email protected]
Subject: Protection key in io uring kthread
Date: Tue, 23 May 2023 19:48:41 -0700	[thread overview]
Message-ID: <CABi2SkUp45HEt7eQ6a47Z7b3LzW=4m3xAakG35os7puCO2dkng@mail.gmail.com> (raw)

Hi
I have a question on the protection key in io_uring. Today, when a
user thread enters the kernel through syscall, PKRU is preserved, and
the kernel  will respect the PKEY protection of memory.

For example:
sys_mprotect_pkey((void *)ptr, size, PROT_READ | PROT_WRITE, pkey);
pkey_write_deny(pkey); <-- disable write access to pkey for this thread.
ret = read(fd, ptr, 1); <-- this will fail in the kernel.

I wonder what is the case for io_uring, since read is now async, will
kthread have the user thread's PKUR ?

In theory, it is possible, i.e. from io_uring_enter syscall. But I
don't know the implementation details of io_uring, hence asking the
expert in this list.

Thanks!
-Jeff

             reply	other threads:[~2023-05-24  2:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24  2:48 Jeff Xu [this message]
2023-05-24 15:06 ` Protection key in io uring kthread Jens Axboe
2023-05-24 17:44   ` Jeff Xu
2023-05-24 18:04     ` Jens Axboe
2023-05-24 19:21       ` Jeff Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABi2SkUp45HEt7eQ6a47Z7b3LzW=4m3xAakG35os7puCO2dkng@mail.gmail.com' \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox