Linux-HyperV List
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Hardik Garg <hargar@linux.microsoft.com>
Cc: Michael Kelley <mhklinux@outlook.com>,
	"kys@microsoft.com" <kys@microsoft.com>,
	"haiyangz@microsoft.com" <haiyangz@microsoft.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	"decui@microsoft.com" <decui@microsoft.com>,
	"ssengar@linux.microsoft.com" <ssengar@linux.microsoft.com>,
	"namjain@linux.microsoft.com" <namjain@linux.microsoft.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] mshv_vtl: Check per-CPU register page before mmap
Date: Thu, 15 Oct 2026 00:41:07 -0700	[thread overview]
Message-ID: <20261015074107.GC936897@liuwe-devbox-debian-v2.local> (raw)
In-Reply-To: <06f970fe-ae23-4b5d-87fc-f2751bacc8bf@linux.microsoft.com>

On Thu, Sep 24, 2026 at 12:19:32PM -0700, Hardik Garg wrote:
> 
> On 9/21/2026 5:14 PM, Michael Kelley wrote:
> > From: Hardik Garg <hargar@linux.microsoft.com>
> >> Register-page setup is optional for each CPU. If allocation or
> >> registration fails, mshv_vtl_configure_reg_page() warns and leaves that
> >> CPU's reg_page NULL, but initial context setup continues successfully.
> >> Meanwhile, successful setup on another CPU sets the global
> >> mshv_has_reg_page flag.
> >>
> >> mshv_vtl_fault() checks this global flag before selecting the requested
> >> CPU's register page. With mixed setup results across online CPUs, the
> >> check passes even for a CPU with no register page, reaching
> >> get_page(NULL) when userspace faults in that mapping.
> > I'm a bit late in reviewing this because I was travelling all last week.
> >
> > This patch seems like it is just papering over the real problem, which
> > is that a global variable like mshv_has_reg_page can't represent the
> > status of an operation that may succeed or fail on a per-cpu basis.
> > I pointed this out (as did Sashiko) in review comments back in
> > April [1].
> >
> > The only other place mshv_has_reg_page is used is in 
> > mshv_ioctl_check_extensions() where its value is returned from an
> > ioctl() system call made by user space. That's a questionable practice
> > since ioctl() usually returns 0 on success, though the man page for
> > ioctl() does admit that some ioctls use the return value as an output
> > parameter and return a non-negative value on success. But even
> > then, a single value can't accurately reflect the status of an
> > operation that may succeed or fail on a per-cpu basis. User
> > space would presumably have a similar problem to what is
> > being fixed by this patch.
> >
> > Is there any reason that the real problem couldn't be fixed
> > instead of doing this fix on top of something that is fundamentally
> > broken?
> >
> > Michael
> >
> > [1] https://lore.kernel.org/linux-hyperv/SN6PR02MB4157CF364DA2C0CC657A6DCBD450A@SN6PR02MB4157.namprd02.prod.outlook.com/
> 
> Hi Michael,
> Thanks for the feedback and for pointing me to your April review.
> After going through it, I understand that the NULL check only addresses
> the immediate fault, while the global capability still misrepresents
> per-CPU availability.
> 
> I'll work on addressing the underlying issue and send a proposed fix
> soon.

I have not seen this new fix yet. I will keep this patch for now.

Wei

      reply	other threads:[~2026-10-15  7:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11 17:51 [PATCH] mshv_vtl: Check per-CPU register page before mmap Hardik Garg
2026-09-11 18:05 ` sashiko-bot
2026-09-11 18:19   ` Hardik Garg
2026-09-15  4:41 ` Naman Jain
2026-09-19 23:02   ` Wei Liu
2026-09-22  0:14 ` Michael Kelley
2026-09-24 19:19   ` Hardik Garg
2026-10-15  7:41     ` Wei Liu [this message]

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=20261015074107.GC936897@liuwe-devbox-debian-v2.local \
    --to=wei.liu@kernel.org \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hargar@linux.microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=namjain@linux.microsoft.com \
    --cc=ssengar@linux.microsoft.com \
    --cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox