Re: [RFC PATCH 7/9] lsm,io_uring: add LSM hooks to io_uring

From
Paul Moore <paul@paul-moore.com>
Date
2021-05-26 20:45:52
Also in
io-uring, linux-fsdevel, selinux
Reply to
Stefan Metzmacher, 2021-05-26
On Wed, May 26, 2021 at 10:48 AM Stefan Metzmacher [off-list ref] wrote:
Hi Paul,
Hi Stefan.
quoted
 #define CREATE_TRACE_POINTS
 #include <trace/events/io_uring.h>
@@ -6537,6 +6538,11 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
              if (!req->work.creds)
                      return -EINVAL;
              get_cred(req->work.creds);
+             ret = security_uring_override_creds(req->work.creds);
+             if (ret) {
+                     put_cred(req->work.creds);
+                     return ret;
+             }
Why are you calling this per requests, shouldn't this be done in
io_register_personality()?
Generally speaking it is more interesting to see when user alice tries
to impersonate bob and not when bob registers his ID as available to
use by others.  We could always add a LSM hook to control when bob
registers his ID, but I think the impersonation is the critical code
path.

However, if I'm misunderstanding how this works in io_uring please correct me.
I'm also not sure if this really gains anything as io_register_personality()
only captures the value of get_current_cred(), so the process already has changed to
the credentials (at least once for the io_uring_register(IORING_REGISTER_PERSONALITY)
call).

metze
-- 
paul moore
www.paul-moore.com
Thread (67 messages) 67 messages, 10 authors, last reply 2021-08-25
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help