All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Oleksandr Tyshchenko <Oleksandr_Tyshchenko@epam.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Anthony Perard <anthony.perard@citrix.com>,
	Paul Durrant <paul@xen.org>,
	"open list:X86 Xen CPUs" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v1 4/7] xen_pvdev: Do not assume Dom0 when creating a directrory
Date: Sun, 12 Nov 2023 16:12:47 -0500	[thread overview]
Message-ID: <851f9138ccc9c4a9ec1c8f7f6c2cc57c652f2b96.camel@infradead.org> (raw)
In-Reply-To: <20231110204207.2927514-5-volodymyr_babchuk@epam.com>

[-- Attachment #1: Type: text/plain, Size: 2537 bytes --]

On Fri, 2023-11-10 at 20:42 +0000, Volodymyr Babchuk wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> 
> Instead of forcing the owner to domid 0, use XS_PRESERVE_OWNER to save
> the previous owner of the directory.
> 

You're missing the words "... if it already exists" from that sentence.

If the directory *didn't* already exist, it gets created with dom0 as
the owner still, right? Assuming XenStore allows QEMU to do that.

Strictly, the node gets created (if permitted) and *then*
xs_set_permissions() attempts to set dom0 as the owner (if permitted).

> Note that for other than Dom0 domain (non toolstack domain) the
> "driver_domain" property should be set in domain config file for the
> toolstack to create required directories in advance.
> 
> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> ---
>  hw/xen/xen_pvdev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/xen/xen_pvdev.c b/hw/xen/xen_pvdev.c
> index c5ad71e8dc..42bdd4f6c8 100644
> --- a/hw/xen/xen_pvdev.c
> +++ b/hw/xen/xen_pvdev.c
> @@ -60,7 +60,8 @@ void xen_config_cleanup(void)
>  
>  int xenstore_mkdir(char *path, int p)
>  {
> -    if (!qemu_xen_xs_create(xenstore, 0, 0, xen_domid, p, path)) {
> +    if (!qemu_xen_xs_create(xenstore, 0, XS_PRESERVE_OWNER,
> +                            xen_domid, p, path)) {
>          xen_pv_printf(NULL, 0, "xs_mkdir %s: failed\n", path);
>          return -1;
>      }

Why bother with xenstore_mkdir()? AFAICT it's *only* used from the
legacy XenLegacyDevice stuff, and can't we just finish the job of
moving from that to the XenDevice model? I've done console and net
recently; want to keep going?

And even then... the xenstore_mkdir() function is called twice from
xen_config_dev_dirs() in hw/xen/xen_devconfig.c to create the frontend
and backend directories — which is what the rest of your patch series
is trying to eliminate because a driver domain doesn't have permissions
to do that anyway.

It's also called from xen_be_register() in hw/xen/xen_devconfig.c to
create device-model/${GUEST_DOMID}/backends/${DEVICE_TYPE} (using a
relative path, so in the driver domain's XenStore). That one presumably
*won't* exist already, and so XS_PRESERVE_OWNER won't even have any
effect?

What practical difference does this even make? Am I missing something?

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

  reply	other threads:[~2023-11-12 21:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10 20:42 [PATCH v1 0/7] xen-arm: add support for virtio-pci Volodymyr Babchuk
2023-11-10 20:42 ` [PATCH v1 1/7] xen-block: Do not write frontend nodes Volodymyr Babchuk
2023-11-11 10:55   ` David Woodhouse
2023-11-11 13:43     ` Andrew Cooper
2023-11-11 20:18       ` David Woodhouse
2023-11-11 21:51         ` Andrew Cooper
2023-11-11 22:22           ` David Woodhouse
2023-11-14 21:32             ` Volodymyr Babchuk
2023-11-14 21:54               ` David Woodhouse
2023-11-12 20:29   ` Paul Durrant
2023-11-10 20:42 ` [PATCH v1 3/7] xen: xenstore: add possibility to preserve owner Volodymyr Babchuk
2023-11-11 11:01   ` David Woodhouse
2023-11-12 21:18     ` David Woodhouse
2023-11-13 13:02       ` Volodymyr Babchuk
2023-11-13 13:00     ` Volodymyr Babchuk
2023-11-12 20:43   ` Paul Durrant
2023-11-10 20:42 ` [PATCH v1 2/7] xen-bus: Do not destroy frontend/backend directories Volodymyr Babchuk
2023-11-12 21:57   ` David Woodhouse
2023-11-10 20:42 ` [PATCH v1 6/7] xen_arm: Set mc->max_cpus to GUEST_MAX_VCPUS in xen_arm_init() Volodymyr Babchuk
2023-11-10 20:42 ` [PATCH v1 4/7] xen_pvdev: Do not assume Dom0 when creating a directrory Volodymyr Babchuk
2023-11-12 21:12   ` David Woodhouse [this message]
2023-11-15  0:22     ` Volodymyr Babchuk
2023-11-10 20:42 ` [PATCH v1 5/7] xen-bus: Set offline if backend's state is XenbusStateClosed Volodymyr Babchuk
2023-11-11 11:42   ` David Woodhouse
2023-11-12 20:37   ` Paul Durrant
2023-11-10 20:42 ` [PATCH v1 7/7] xen_arm: Add basic virtio-pci support Volodymyr Babchuk
2023-11-12 22:11   ` David Woodhouse
2023-11-13 12:01     ` Volodymyr Babchuk

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=851f9138ccc9c4a9ec1c8f7f6c2cc57c652f2b96.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=Oleksandr_Tyshchenko@epam.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=anthony.perard@citrix.com \
    --cc=paul@xen.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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.