From: Mike Christie <michael.christie@oracle.com>
To: linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, mst@redhat.com,
sgarzare@redhat.com, jasowang@redhat.com, stefanha@redhat.com,
christian@brauner.io, akpm@linux-foundation.org,
peterz@infradead.org, christian.brauner@ubuntu.com
Cc: Mike Christie <michael.christie@oracle.com>
Subject: [PATCH 3/3] vhost: pass kthread user to check RLIMIT_NPROC
Date: Wed, 23 Jun 2021 22:08:04 -0500 [thread overview]
Message-ID: <20210624030804.4932-4-michael.christie@oracle.com> (raw)
In-Reply-To: <20210624030804.4932-1-michael.christie@oracle.com>
This has vhost pass in the user to the kthread API, so the process doing
the ioctl has its RLIMIT_NPROC checked and its processes count
incremented.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
drivers/vhost/vhost.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 5ccb0705beae..141cca6fd50a 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -595,8 +595,9 @@ long vhost_dev_set_owner(struct vhost_dev *dev)
dev->kcov_handle = kcov_common_handle();
if (dev->use_worker) {
- worker = kthread_create(vhost_worker, dev,
- "vhost-%d", current->pid);
+ worker = kthread_create_for_user(vhost_worker, dev,
+ current->real_cred->user,
+ "vhost-%d", current->pid);
if (IS_ERR(worker)) {
err = PTR_ERR(worker);
goto err_worker;
--
2.25.1
next prev parent reply other threads:[~2021-06-24 3:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 3:08 [PATCH 0/3] kthread: pass in user and check RLIMIT_NPROC Mike Christie
2021-06-24 3:08 ` [PATCH 1/3] kthread: allow caller to pass in user_struct Mike Christie
2021-06-24 4:34 ` kernel test robot
2021-06-24 16:19 ` Mike Christie
2021-06-24 3:08 ` [PATCH 2/3] kernel/fork, cred.c: allow copy_process to take user Mike Christie
2021-06-29 13:04 ` Christian Brauner
2021-06-29 16:53 ` Mike Christie
2021-07-01 23:59 ` michael.christie
2021-06-24 3:08 ` Mike Christie [this message]
2021-06-24 8:26 ` [PATCH 3/3] vhost: pass kthread user to check RLIMIT_NPROC kernel test robot
2021-06-24 16:18 ` Mike Christie
2021-06-24 7:34 ` [PATCH 0/3] kthread: pass in user and " Michael S. Tsirkin
2021-06-24 9:40 ` Stefan Hajnoczi
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=20210624030804.4932-4-michael.christie@oracle.com \
--to=michael.christie@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=christian.brauner@ubuntu.com \
--cc=christian@brauner.io \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=peterz@infradead.org \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).