From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Martin Wilck <mwilck@suse.com>,
Benjamin Marzinski <bmarzins@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Hannes Reinecke <hare@suse.de>,
afaria@redhat.com, qemu-devel@nongnu.org,
Mikulas Patocka <mpatocka@redhat.com>
Subject: Re: Moving from qemu-pr-helper and libmpathpersist to <linux/pr.h>
Date: Thu, 5 Feb 2026 08:39:30 -0500 [thread overview]
Message-ID: <20260205133930.GA36872@fedora> (raw)
In-Reply-To: <aYSGia2Zy_g5iop5@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2785 bytes --]
On Thu, Feb 05, 2026 at 12:01:13PM +0000, Daniel P. Berrangé wrote:
> On Thu, Feb 05, 2026 at 12:52:33PM +0100, Martin Wilck wrote:
> > On Wed, 2026-02-04 at 13:32 -0500, Stefan Hajnoczi wrote:
> > > On Wed, Feb 04, 2026 at 02:19:48PM +0100, Martin Wilck wrote:
> > > > Hi Stefan,
> > > >
> > > > So the ioctls will pass through qemu into the kernel, to be
> > > > intercepted
> > > > by the dm-mpath driver, which will use an upcall to have them
> > > > handled
> > > > by mpathpersistd (for the actual command) and multipathd (for the
> > > > path
> > > > registrations).
> > > >
> > > > I don't fully understand the advantage, security and complexity-
> > > > wise,
> > > > of this concept, compared to intercepting them qemu and using a
> > > > socket
> > > > to talk to mpathpersistd directly. If we did this, we could even
> > > > support both generic and SCSI PR commands.
> > >
> > > Hi Martin,
> > > The simplification and security benefits are on the application side,
> > > not on the DM-Multipath side, so I can see what you're getting at.
> > > From
> > > the DM-Multipath perspective things get a little more complex.
> > >
> > > From an application perspective, a single API that works across block
> > > device types (SCSI, NVMe, DM-Multipath) and requires no privileges or
> > > sockets (they are a pain in container environments) is the most
> > > convenient. The <linux/pr.h> ioctl API offers exactly this.
> >
> > I may be missing something, but AFAICS the PR ioctls require having a
> > block device open for writing, which does either require root
> > privileges, or some file descriptor previously opened with privileges
> > and forwarded to another, less privileged process. No?
>
> While QEMU is run unprivileged, libvirt will grant QEMU access any block
> devices that have been configured for the guest in question. On Linux,
> libvirt will create a new /dev tmpfs populated with the allow-list of
> device nodes the guest is permitted to access, with suitable file
> permissions, ownership & SELinux labels set.
Ultimately something does require privileges to give an unprivileged
application access to a block device. That could be udev rules, it could
be libvirt, etc.
I would say the real distinction is between the privileges needed so the
application can access the block device vs the privileges needed to
perform PR operations. If udev or libvirt has set up block device nodes,
an unprivileged application can open them for read/write access. But it
would require CAP_SYS_RAWIO for SG_IO PR operations on top of that
whereas <linux/pr.h> ioctls do not require that.
Therefore there is a real advantages regarding privileges when using
<linux/pr.h> ioctls vs libmpathpersist.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2026-02-05 13:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 18:47 Moving from qemu-pr-helper and libmpathpersist to <linux/pr.h> Stefan Hajnoczi
2026-01-27 19:45 ` Paolo Bonzini
2026-01-28 14:18 ` Stefan Hajnoczi
2026-01-28 15:30 ` Hannes Reinecke
2026-01-28 16:13 ` Stefan Hajnoczi
2026-01-27 21:06 ` Benjamin Marzinski
2026-02-03 15:09 ` Stefan Hajnoczi
2026-02-03 17:53 ` Benjamin Marzinski
2026-02-03 18:04 ` Stefan Hajnoczi
2026-02-04 13:19 ` Martin Wilck
2026-02-04 18:32 ` Stefan Hajnoczi
2026-02-04 23:57 ` Hannes Reinecke
2026-02-05 1:03 ` Benjamin Marzinski
2026-02-05 10:20 ` Martin Wilck
2026-02-05 11:52 ` Martin Wilck
2026-02-05 12:01 ` Daniel P. Berrangé
2026-02-05 13:39 ` Stefan Hajnoczi [this message]
2026-02-06 0:03 ` Hannes Reinecke
2026-02-06 14:08 ` Stefan Hajnoczi
2026-02-09 12:50 ` Hannes Reinecke
2026-02-09 14:23 ` Stefan Hajnoczi
2026-02-10 10:23 ` Martin Wilck
2026-02-10 13:59 ` Stefan Hajnoczi
2026-02-10 14:29 ` Martin Wilck
2026-02-05 14:28 ` 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=20260205133930.GA36872@fedora \
--to=stefanha@redhat.com \
--cc=afaria@redhat.com \
--cc=berrange@redhat.com \
--cc=bmarzins@redhat.com \
--cc=hare@suse.de \
--cc=kwolf@redhat.com \
--cc=mpatocka@redhat.com \
--cc=mwilck@suse.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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.