From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Mykyta Poturai <Mykyta_Poturai@epam.com>
Cc: Jan Beulich <jbeulich@suse.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [XEN PATCH] xen/vpci: Fix UB in mask_write
Date: Tue, 12 Nov 2024 12:26:21 +0100 [thread overview]
Message-ID: <ZzM7XZmKfFxys819@macbook> (raw)
In-Reply-To: <f5d8396b-26a7-476d-9871-63f603b983bd@epam.com>
On Mon, Nov 11, 2024 at 12:21:32PM +0000, Mykyta Poturai wrote:
> On 06.11.24 16:57, Roger Pau Monné wrote:
> >
> > Let's try to figure out what causes msi_maxvec to be 0 in your case
> > and then we can see how to better detect this. If msi_maxvec needs to
> > be checked it should likely be done in init_msi().
> >
> > Regards, Roger.
>
> Hi everyone,
> So I have done some more investigations, and I think it finally makes
> sense. The real cause of my crashes was a long-standing bug in yet to be
> upstreamed vpci patches where the register value and offset were swapped
> by mistake. And this bug was hidden for a long time because mask_write
> skipped actually doing anything, respecting vectors = 0, so I failed to
> spot it from the get-go.
>
> Regarding msi_maxvec there seems to be an implicit dependency between
> CONFIG_HAS_VPCI and CONFIG_HAS_PCI_MSI. If HAS_PCI_MSI=n, then
> pdev_msi_init gets replaced with a stub and msi_maxvec remains 0, but it
> is still used in control_write unconditionally.
Hello,
If HAS_PCI_MSI=n then vPCI shouldn't attempt to handle the MSI(-X)
capabilities in the first place. However that can lead to incorrect
scenarios if vPCI is used for dom0, as vPCI not supporting MSI(-X)
grants dom0 unmediated access to the capability registers, which won't
result in a functional system at least on x86.
I think the more robust solution is for vPCI to require
HAS_PCI_MSI=y.
Thanks, Roger.
next prev parent reply other threads:[~2024-11-12 11:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 8:05 [XEN PATCH] xen/vpci: Fix UB in mask_write Mykyta Poturai
2024-11-06 9:00 ` Roger Pau Monné
2024-11-06 9:07 ` Roger Pau Monné
2024-11-06 11:31 ` Jan Beulich
2024-11-06 12:26 ` Mykyta Poturai
2024-11-06 12:42 ` Roger Pau Monné
2024-11-06 14:32 ` Mykyta Poturai
2024-11-06 14:57 ` Roger Pau Monné
2024-11-11 12:21 ` Mykyta Poturai
2024-11-12 11:26 ` Roger Pau Monné [this message]
2024-11-07 9:25 ` Jan Beulich
2024-11-07 9:36 ` Roger Pau Monné
2024-11-06 11:35 ` Jan Beulich
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=ZzM7XZmKfFxys819@macbook \
--to=roger.pau@citrix.com \
--cc=Mykyta_Poturai@epam.com \
--cc=jbeulich@suse.com \
--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.