From: Hans de Goede <hansg@kernel.org>
To: Hungyu Lin <dennylin0707@gmail.com>
Cc: arnd@arndb.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] virt: vbox: Do not report user namespace root as root to the host
Date: Fri, 13 Nov 2026 10:48:00 +0100 [thread overview]
Message-ID: <aa4fecc0-60f3-4888-8a78-64e3efb7e096@kernel.org> (raw)
In-Reply-To: <20261113090758.87172-1-dennylin0707@gmail.com>
Hi,
On 13-Nov-26 10:07, Hungyu Lin wrote:
> vbg_misc_device_requestor() decides whether the opener of the vboxguest
> or vboxuser device is reported to the host as root:
>
> if (from_kuid(current_user_ns(), current_uid()) == 0)
> requestor |= VMMDEV_REQUESTOR_USR_ROOT;
>
> from_kuid() translates the uid into the user namespace of the caller.
> An unprivileged user who creates a user namespace and maps their uid to
> 0 in it is therefore reported as VMMDEV_REQUESTOR_USR_ROOT for every
> request of that session, although the uid has no privileges outside of
> that namespace. The host uses the user class to account the HGCM
> requests of a session, so such a user is charged to the budget of root
> instead of the one for ordinary users.
>
> Compare the uid against GLOBAL_ROOT_UID so that only root in the initial
> user namespace is reported as root.
>
> Fixes: 0532a1b0d045 ("virt: vbox: Implement passing requestor info to the host for VirtualBox 6.0.x")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Regards,
Hans
> ---
> drivers/virt/vboxguest/vboxguest_linux.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/virt/vboxguest/vboxguest_linux.c b/drivers/virt/vboxguest/vboxguest_linux.c
> index 7474bae2cd9a..ff66c00c27da 100644
> --- a/drivers/virt/vboxguest/vboxguest_linux.c
> +++ b/drivers/virt/vboxguest/vboxguest_linux.c
> @@ -35,7 +35,7 @@ static u32 vbg_misc_device_requestor(struct inode *inode)
> VMMDEV_REQUESTOR_CON_DONT_KNOW |
> VMMDEV_REQUESTOR_TRUST_NOT_GIVEN;
>
> - if (from_kuid(current_user_ns(), current_uid()) == 0)
> + if (uid_eq(current_uid(), GLOBAL_ROOT_UID))
> requestor |= VMMDEV_REQUESTOR_USR_ROOT;
> else
> requestor |= VMMDEV_REQUESTOR_USR_USER;
> --
> 2.43.0
next prev parent reply other threads:[~2026-11-13 9:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 9:07 [PATCH] virt: vbox: Do not report user namespace root as root to the host Hungyu Lin
2026-11-13 9:48 ` Hans de Goede [this message]
2026-12-04 1:03 ` Hungyu Lin
2026-12-04 4:02 ` Greg KH
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=aa4fecc0-60f3-4888-8a78-64e3efb7e096@kernel.org \
--to=hansg@kernel.org \
--cc=arnd@arndb.de \
--cc=dennylin0707@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.