All of lore.kernel.org
 help / color / mirror / Atom feed
From: Toshi Kani <toshi.kani@hpe.com>
To: "Luck, Tony" <tony.luck@intel.com>, "bp@alien8.de" <bp@alien8.de>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	"rjw@rjwysocki.net" <rjw@rjwysocki.net>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM
Date: Mon, 26 Oct 2015 10:31:55 -0600	[thread overview]
Message-ID: <1445877115.20657.88.camel@hpe.com> (raw)
In-Reply-To: <3908561D78D1C84285E8C5FCA982C28F32B5F5AF@ORSMSX114.amr.corp.intel.com>

On Mon, 2015-10-26 at 16:26 +0000, Luck, Tony wrote:
> -	pfn = PFN_DOWN(param1 & param2);
> -	if (!page_is_ram(pfn) || ((param2 & PAGE_MASK) != PAGE_MASK))
> +	base_addr = param1 & param2;
> +	size = (~param2) + 1;
> 
> We expect the user will supply us with param2 in the form 0xffffffff[fec8]00000
> with various numbers of leading 'f' and trailing '0' ... but I don't think we actually
> check that anywhere.  But we have a bunch of places that assume it is OK, including
> this new one.
> 
> It's time to fix that.  Maybe even provide a default 0xfffffffffffff000 so I can save 
> myself some typing?

+       if (((region_intersects_ram(base_addr, size) != REGION_INTERSECTS) &&
+            (region_intersects_pmem(base_addr, size) != REGION_INTERSECTS)) ||
+           ((param2 & PAGE_MASK) != PAGE_MASK))
                return -EINVAL;

The 3rd condition check makes sure that the param2 mask is the page size or less.  So, I
think we are OK on this.

Thanks,
-Toshi

WARNING: multiple messages have this Message-ID (diff)
From: Toshi Kani <toshi.kani@hpe.com>
To: "Luck, Tony" <tony.luck@intel.com>, "bp@alien8.de" <bp@alien8.de>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	"rjw@rjwysocki.net" <rjw@rjwysocki.net>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM
Date: Mon, 26 Oct 2015 10:31:55 -0600	[thread overview]
Message-ID: <1445877115.20657.88.camel@hpe.com> (raw)
In-Reply-To: <3908561D78D1C84285E8C5FCA982C28F32B5F5AF@ORSMSX114.amr.corp.intel.com>

On Mon, 2015-10-26 at 16:26 +0000, Luck, Tony wrote:
> -	pfn = PFN_DOWN(param1 & param2);
> -	if (!page_is_ram(pfn) || ((param2 & PAGE_MASK) != PAGE_MASK))
> +	base_addr = param1 & param2;
> +	size = (~param2) + 1;
> 
> We expect the user will supply us with param2 in the form 0xffffffff[fec8]00000
> with various numbers of leading 'f' and trailing '0' ... but I don't think we actually
> check that anywhere.  But we have a bunch of places that assume it is OK, including
> this new one.
> 
> It's time to fix that.  Maybe even provide a default 0xfffffffffffff000 so I can save 
> myself some typing?

+       if (((region_intersects_ram(base_addr, size) != REGION_INTERSECTS) &&
+            (region_intersects_pmem(base_addr, size) != REGION_INTERSECTS)) ||
+           ((param2 & PAGE_MASK) != PAGE_MASK))
                return -EINVAL;

The 3rd condition check makes sure that the param2 mask is the page size or less.  So, I
think we are OK on this.

Thanks,
-Toshi

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Toshi Kani <toshi.kani@hpe.com>
To: "Luck, Tony" <tony.luck@intel.com>, "bp@alien8.de" <bp@alien8.de>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	"rjw@rjwysocki.net" <rjw@rjwysocki.net>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@ml01.01.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM
Date: Mon, 26 Oct 2015 10:31:55 -0600	[thread overview]
Message-ID: <1445877115.20657.88.camel@hpe.com> (raw)
In-Reply-To: <3908561D78D1C84285E8C5FCA982C28F32B5F5AF@ORSMSX114.amr.corp.intel.com>

On Mon, 2015-10-26 at 16:26 +0000, Luck, Tony wrote:
> -	pfn = PFN_DOWN(param1 & param2);
> -	if (!page_is_ram(pfn) || ((param2 & PAGE_MASK) != PAGE_MASK))
> +	base_addr = param1 & param2;
> +	size = (~param2) + 1;
> 
> We expect the user will supply us with param2 in the form 0xffffffff[fec8]00000
> with various numbers of leading 'f' and trailing '0' ... but I don't think we actually
> check that anywhere.  But we have a bunch of places that assume it is OK, including
> this new one.
> 
> It's time to fix that.  Maybe even provide a default 0xfffffffffffff000 so I can save 
> myself some typing?

+       if (((region_intersects_ram(base_addr, size) != REGION_INTERSECTS) &&
+            (region_intersects_pmem(base_addr, size) != REGION_INTERSECTS)) ||
+           ((param2 & PAGE_MASK) != PAGE_MASK))
                return -EINVAL;

The 3rd condition check makes sure that the param2 mask is the page size or less.  So, I
think we are OK on this.

Thanks,
-Toshi

  reply	other threads:[~2015-10-26 16:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-26 15:03 [PATCH v2 UPDATE 3/3] ACPI/APEI/EINJ: Allow memory error injection to NVDIMM Toshi Kani
2015-10-26 15:03 ` Toshi Kani
2015-10-26 15:03 ` Toshi Kani
2015-10-26 16:26 ` Luck, Tony
2015-10-26 16:26   ` Luck, Tony
2015-10-26 16:26   ` Luck, Tony
2015-10-26 16:31   ` Toshi Kani [this message]
2015-10-26 16:31     ` Toshi Kani
2015-10-26 16:31     ` Toshi Kani
2015-10-26 16:46     ` Luck, Tony
2015-10-26 16:46       ` Luck, Tony
2015-10-26 16:51       ` Toshi Kani
2015-10-26 16:51         ` Toshi Kani
2015-10-26 16:51         ` Toshi Kani

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=1445877115.20657.88.camel@hpe.com \
    --to=toshi.kani@hpe.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=rjw@rjwysocki.net \
    --cc=tony.luck@intel.com \
    /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.