From: Lu Baolu <baolu.lu@linux.intel.com> To: Barret Rhoden <brho@google.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>, David Woodhouse <dwmw2@infradead.org>, Joerg Roedel <joro@8bytes.org>, Yian Chen <yian.chen@intel.com>, Sohil Mehta <sohil.mehta@intel.com> Cc: baolu.lu@linux.intel.com, iommu@lists.linux-foundation.org, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] iommu/vt-d: skip invalid RMRR entries Date: Wed, 8 Jan 2020 09:27:36 +0800 [thread overview] Message-ID: <bc129b51-73d3-3ed0-93a5-07df6566d535@linux.intel.com> (raw) In-Reply-To: <20200107191610.178185-3-brho@google.com> Hi, On 1/8/20 3:16 AM, Barret Rhoden via iommu wrote: > The VT-d docs specify requirements for the RMRR entries base and end > (called 'Limit' in the docs) addresses. > > This commit will cause the DMAR processing to skip any RMRR entries that > do not meet these requirements and mark the firmware as tainted, since > the firmware is giving us junk. > > Signed-off-by: Barret Rhoden <brho@google.com> > --- > drivers/iommu/intel-iommu.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > index a8bb458845bc..32c3c6338a3d 100644 > --- a/drivers/iommu/intel-iommu.c > +++ b/drivers/iommu/intel-iommu.c > @@ -4315,13 +4315,25 @@ static void __init init_iommu_pm_ops(void) > static inline void init_iommu_pm_ops(void) {} > #endif /* CONFIG_PM */ > > +static int rmrr_validity_check(struct acpi_dmar_reserved_memory *rmrr) > +{ > + if ((rmrr->base_address & PAGE_MASK) || > + (rmrr->end_address <= rmrr->base_address) || > + ((rmrr->end_address - rmrr->base_address + 1) & PAGE_MASK)) { > + pr_err(FW_BUG "Broken RMRR base: %#018Lx end: %#018Lx\n", > + rmrr->base_address, rmrr->end_address); Since you will WARN_TAINT below, do you still want an error message here? > + return -EINVAL; > + } > + return 0; > +} > + > int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg) > { > struct acpi_dmar_reserved_memory *rmrr; > struct dmar_rmrr_unit *rmrru; > > rmrr = (struct acpi_dmar_reserved_memory *)header; > - if (arch_rmrr_sanity_check(rmrr)) { > + if (rmrr_validity_check(rmrr) || arch_rmrr_sanity_check(rmrr)) { > WARN_TAINT(1, TAINT_FIRMWARE_WORKAROUND, > "Your BIOS is broken; bad RMRR [%#018Lx-%#018Lx]\n" > "BIOS vendor: %s; Ver: %s; Product Version: %s\n", > Best regards, baolu
WARNING: multiple messages have this Message-ID (diff)
From: Lu Baolu <baolu.lu@linux.intel.com> To: Barret Rhoden <brho@google.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>, David Woodhouse <dwmw2@infradead.org>, Joerg Roedel <joro@8bytes.org>, Yian Chen <yian.chen@intel.com>, Sohil Mehta <sohil.mehta@intel.com> Cc: iommu@lists.linux-foundation.org, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] iommu/vt-d: skip invalid RMRR entries Date: Wed, 8 Jan 2020 09:27:36 +0800 [thread overview] Message-ID: <bc129b51-73d3-3ed0-93a5-07df6566d535@linux.intel.com> (raw) In-Reply-To: <20200107191610.178185-3-brho@google.com> Hi, On 1/8/20 3:16 AM, Barret Rhoden via iommu wrote: > The VT-d docs specify requirements for the RMRR entries base and end > (called 'Limit' in the docs) addresses. > > This commit will cause the DMAR processing to skip any RMRR entries that > do not meet these requirements and mark the firmware as tainted, since > the firmware is giving us junk. > > Signed-off-by: Barret Rhoden <brho@google.com> > --- > drivers/iommu/intel-iommu.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > index a8bb458845bc..32c3c6338a3d 100644 > --- a/drivers/iommu/intel-iommu.c > +++ b/drivers/iommu/intel-iommu.c > @@ -4315,13 +4315,25 @@ static void __init init_iommu_pm_ops(void) > static inline void init_iommu_pm_ops(void) {} > #endif /* CONFIG_PM */ > > +static int rmrr_validity_check(struct acpi_dmar_reserved_memory *rmrr) > +{ > + if ((rmrr->base_address & PAGE_MASK) || > + (rmrr->end_address <= rmrr->base_address) || > + ((rmrr->end_address - rmrr->base_address + 1) & PAGE_MASK)) { > + pr_err(FW_BUG "Broken RMRR base: %#018Lx end: %#018Lx\n", > + rmrr->base_address, rmrr->end_address); Since you will WARN_TAINT below, do you still want an error message here? > + return -EINVAL; > + } > + return 0; > +} > + > int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg) > { > struct acpi_dmar_reserved_memory *rmrr; > struct dmar_rmrr_unit *rmrru; > > rmrr = (struct acpi_dmar_reserved_memory *)header; > - if (arch_rmrr_sanity_check(rmrr)) { > + if (rmrr_validity_check(rmrr) || arch_rmrr_sanity_check(rmrr)) { > WARN_TAINT(1, TAINT_FIRMWARE_WORKAROUND, > "Your BIOS is broken; bad RMRR [%#018Lx-%#018Lx]\n" > "BIOS vendor: %s; Ver: %s; Product Version: %s\n", > Best regards, baolu _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2020-01-08 1:28 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-07 19:16 [PATCH v2 0/2] iommu/vt-d bad RMRR workarounds Barret Rhoden 2020-01-07 19:16 ` Barret Rhoden via iommu 2020-01-07 19:16 ` [PATCH v2 1/2] iommu/vt-d: skip RMRR entries that fail the sanity check Barret Rhoden 2020-01-07 19:16 ` Barret Rhoden via iommu 2020-01-07 19:16 ` [PATCH v2 2/2] iommu/vt-d: skip invalid RMRR entries Barret Rhoden 2020-01-07 19:16 ` Barret Rhoden via iommu 2020-01-08 1:27 ` Lu Baolu [this message] 2020-01-08 1:27 ` Lu Baolu 2020-01-08 17:35 ` Barret Rhoden 2020-01-08 17:35 ` Barret Rhoden via iommu 2020-01-10 19:27 ` Chen, Yian 2020-01-10 19:27 ` Chen, Yian
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=bc129b51-73d3-3ed0-93a5-07df6566d535@linux.intel.com \ --to=baolu.lu@linux.intel.com \ --cc=bp@alien8.de \ --cc=brho@google.com \ --cc=dwmw2@infradead.org \ --cc=hpa@zytor.com \ --cc=iommu@lists.linux-foundation.org \ --cc=joro@8bytes.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mingo@redhat.com \ --cc=sohil.mehta@intel.com \ --cc=tglx@linutronix.de \ --cc=x86@kernel.org \ --cc=yian.chen@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: linkBe 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.