linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sunil Muthuswamy <sunilmut@microsoft.com>
To: Praveen Kumar <kumarpraveen@linux.microsoft.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	Dexuan Cui <decui@microsoft.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"bp@alien8.de" <bp@alien8.de>, "x86@kernel.org" <x86@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"viremana@linux.microsoft.com" <viremana@linux.microsoft.com>,
	"nunodasneves@linux.microsoft.com"
	<nunodasneves@linux.microsoft.com>
Subject: RE: [PATCH v3] hyperv: root partition faults writing to VP ASSIST MSR PAGE
Date: Tue, 27 Jul 2021 17:23:10 +0000	[thread overview]
Message-ID: <MW4PR21MB20025A2D5D768E6E8405397FC0E99@MW4PR21MB2002.namprd21.prod.outlook.com> (raw)
In-Reply-To: <1a14d92d-c666-72ba-6c2d-e4385e36a056@linux.microsoft.com>

> >>  static int hv_cpu_init(unsigned int cpu)
> >>  {
> >> +	union hv_vp_assist_msr_contents msr;
> >>  	struct hv_vp_assist_page **hvp = &hv_vp_assist_page[smp_processor_id()];
> >>  	int ret;
> >>
> >> @@ -54,27 +55,41 @@ static int hv_cpu_init(unsigned int cpu)
> >>  	if (!hv_vp_assist_page)
> >>  		return 0;
> >
> > Not related to this code, but I am not sure about the usefulness of this NULL check as
> > we have already accessed this pointer above. If it was NULL, things would already
> > blow up.
> >
> What I understood, hvp will point to "hv_vp_assist_page stack address + smp_processor_id()"
> So, we are good, and this NULL check is required, as in when we de-reference the location, later in the code, it may fault.
> Please do correct me if my understanding is wrong here. Thanks.
> 

'hv_vp_assist_page' comes from the heap, there is nothing on the stack there. As I
mentioned previously, if 'hv_vp_assist_page' was NULL, we would have already
crashed by now, as we are accessing it above. So, the check here is useless in my opinion.
But, since this is code that this patch doesn't touch, its fine to leave it as is for this patch.
I was just pointing it out.

- Sunil


  reply	other threads:[~2021-07-27 17:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 10:40 [PATCH v3] hyperv: root partition faults writing to VP ASSIST MSR PAGE Praveen Kumar
2021-07-27 16:35 ` Michael Kelley
2021-07-27 16:51   ` Sunil Muthuswamy
2021-07-27 16:58   ` Praveen Kumar
2021-07-27 16:45 ` Sunil Muthuswamy
2021-07-27 17:12   ` Praveen Kumar
2021-07-27 17:23     ` Sunil Muthuswamy [this message]
2021-07-27 17:51 ` Wei Liu

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=MW4PR21MB20025A2D5D768E6E8405397FC0E99@MW4PR21MB2002.namprd21.prod.outlook.com \
    --to=sunilmut@microsoft.com \
    --cc=bp@alien8.de \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=kumarpraveen@linux.microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nunodasneves@linux.microsoft.com \
    --cc=sthemmin@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=viremana@linux.microsoft.com \
    --cc=wei.liu@kernel.org \
    --cc=x86@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;
as well as URLs for NNTP newsgroup(s).