From: Lu Baolu <baolu.lu@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>,
David Woodhouse <dwmw2@infradead.org>,
Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] iommu/vt-d: dmar: replace WARN_TAINT with pr_warn + add_taint
Date: Tue, 10 Mar 2020 09:44:09 +0800 [thread overview]
Message-ID: <65bf12cc-0cf8-40e6-678b-b7b6775a3bf2@linux.intel.com> (raw)
In-Reply-To: <20200309140138.3753-2-hdegoede@redhat.com>
On 2020/3/9 22:01, Hans de Goede wrote:
> Quoting from the comment describing the WARN functions in
> include/asm-generic/bug.h:
>
> * WARN(), WARN_ON(), WARN_ON_ONCE, and so on can be used to report
> * significant kernel issues that need prompt attention if they should ever
> * appear at runtime.
> *
> * Do not use these macros when checking for invalid external inputs
>
> The (buggy) firmware tables which the dmar code was calling WARN_TAINT
> for really are invalid external inputs. They are not under the kernel's
> control and the issues in them cannot be fixed by a kernel update.
> So logging a backtrace, which invites bug reports to be filed about this,
> is not helpful.
>
> Some distros, e.g. Fedora, have tools watching for the kernel backtraces
> logged by the WARN macros and offer the user an option to file a bug for
> this when these are encountered. The WARN_TAINT in warn_invalid_dmar()
> + another iommu WARN_TAINT, addressed in another patch, have lead to over
> a 100 bugs being filed this way.
>
> This commit replaces the WARN_TAINT("...") calls, with
> pr_warn(FW_BUG "...") + add_taint(TAINT_FIRMWARE_WORKAROUND, ...) calls
> avoiding the backtrace and thus also avoiding bug-reports being filed
> about this against the kernel.
>
> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1564895
> Fixes: e625b4a95d50 ("iommu/vt-d: Parse ANDD records")
> Fixes: fd0c8894893c ("intel-iommu: Set a more specific taint flag for invalid BI
> Cc: stable@vger.kernel.org
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Best regards,
baolu
> ---
> drivers/iommu/dmar.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index 071bb42bbbc5..87194a46cb0b 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -440,12 +440,13 @@ static int __init dmar_parse_one_andd(struct acpi_dmar_header *header,
>
> /* Check for NUL termination within the designated length */
> if (strnlen(andd->device_name, header->length - 8) == header->length - 8) {
> - WARN_TAINT(1, TAINT_FIRMWARE_WORKAROUND,
> + pr_warn(FW_BUG
> "Your BIOS is broken; ANDD object name is not NUL-terminated\n"
> "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
> dmi_get_system_info(DMI_BIOS_VENDOR),
> dmi_get_system_info(DMI_BIOS_VERSION),
> dmi_get_system_info(DMI_PRODUCT_VERSION));
> + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
> return -EINVAL;
> }
> pr_info("ANDD device: %x name: %s\n", andd->device_number,
> @@ -471,14 +472,14 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header *header, void *arg)
> return 0;
> }
> }
> - WARN_TAINT(
> - 1, TAINT_FIRMWARE_WORKAROUND,
> + pr_warn(FW_BUG
> "Your BIOS is broken; RHSA refers to non-existent DMAR unit at %llx\n"
> "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
> drhd->reg_base_addr,
> dmi_get_system_info(DMI_BIOS_VENDOR),
> dmi_get_system_info(DMI_BIOS_VERSION),
> dmi_get_system_info(DMI_PRODUCT_VERSION));
> + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
>
> return 0;
> }
> @@ -827,14 +828,14 @@ int __init dmar_table_init(void)
>
> static void warn_invalid_dmar(u64 addr, const char *message)
> {
> - WARN_TAINT_ONCE(
> - 1, TAINT_FIRMWARE_WORKAROUND,
> + pr_warn_once(FW_BUG
> "Your BIOS is broken; DMAR reported at address %llx%s!\n"
> "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
> addr, message,
> dmi_get_system_info(DMI_BIOS_VENDOR),
> dmi_get_system_info(DMI_BIOS_VERSION),
> dmi_get_system_info(DMI_PRODUCT_VERSION));
> + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
> }
>
> static int __ref
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
WARNING: multiple messages have this Message-ID (diff)
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>,
David Woodhouse <dwmw2@infradead.org>,
Joerg Roedel <joro@8bytes.org>
Cc: baolu.lu@linux.intel.com, iommu@lists.linux-foundation.org,
stable@vger.kernel.org
Subject: Re: [PATCH 1/2] iommu/vt-d: dmar: replace WARN_TAINT with pr_warn + add_taint
Date: Tue, 10 Mar 2020 09:44:09 +0800 [thread overview]
Message-ID: <65bf12cc-0cf8-40e6-678b-b7b6775a3bf2@linux.intel.com> (raw)
In-Reply-To: <20200309140138.3753-2-hdegoede@redhat.com>
On 2020/3/9 22:01, Hans de Goede wrote:
> Quoting from the comment describing the WARN functions in
> include/asm-generic/bug.h:
>
> * WARN(), WARN_ON(), WARN_ON_ONCE, and so on can be used to report
> * significant kernel issues that need prompt attention if they should ever
> * appear at runtime.
> *
> * Do not use these macros when checking for invalid external inputs
>
> The (buggy) firmware tables which the dmar code was calling WARN_TAINT
> for really are invalid external inputs. They are not under the kernel's
> control and the issues in them cannot be fixed by a kernel update.
> So logging a backtrace, which invites bug reports to be filed about this,
> is not helpful.
>
> Some distros, e.g. Fedora, have tools watching for the kernel backtraces
> logged by the WARN macros and offer the user an option to file a bug for
> this when these are encountered. The WARN_TAINT in warn_invalid_dmar()
> + another iommu WARN_TAINT, addressed in another patch, have lead to over
> a 100 bugs being filed this way.
>
> This commit replaces the WARN_TAINT("...") calls, with
> pr_warn(FW_BUG "...") + add_taint(TAINT_FIRMWARE_WORKAROUND, ...) calls
> avoiding the backtrace and thus also avoiding bug-reports being filed
> about this against the kernel.
>
> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1564895
> Fixes: e625b4a95d50 ("iommu/vt-d: Parse ANDD records")
> Fixes: fd0c8894893c ("intel-iommu: Set a more specific taint flag for invalid BI
> Cc: stable@vger.kernel.org
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Best regards,
baolu
> ---
> drivers/iommu/dmar.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index 071bb42bbbc5..87194a46cb0b 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -440,12 +440,13 @@ static int __init dmar_parse_one_andd(struct acpi_dmar_header *header,
>
> /* Check for NUL termination within the designated length */
> if (strnlen(andd->device_name, header->length - 8) == header->length - 8) {
> - WARN_TAINT(1, TAINT_FIRMWARE_WORKAROUND,
> + pr_warn(FW_BUG
> "Your BIOS is broken; ANDD object name is not NUL-terminated\n"
> "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
> dmi_get_system_info(DMI_BIOS_VENDOR),
> dmi_get_system_info(DMI_BIOS_VERSION),
> dmi_get_system_info(DMI_PRODUCT_VERSION));
> + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
> return -EINVAL;
> }
> pr_info("ANDD device: %x name: %s\n", andd->device_number,
> @@ -471,14 +472,14 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header *header, void *arg)
> return 0;
> }
> }
> - WARN_TAINT(
> - 1, TAINT_FIRMWARE_WORKAROUND,
> + pr_warn(FW_BUG
> "Your BIOS is broken; RHSA refers to non-existent DMAR unit at %llx\n"
> "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
> drhd->reg_base_addr,
> dmi_get_system_info(DMI_BIOS_VENDOR),
> dmi_get_system_info(DMI_BIOS_VERSION),
> dmi_get_system_info(DMI_PRODUCT_VERSION));
> + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
>
> return 0;
> }
> @@ -827,14 +828,14 @@ int __init dmar_table_init(void)
>
> static void warn_invalid_dmar(u64 addr, const char *message)
> {
> - WARN_TAINT_ONCE(
> - 1, TAINT_FIRMWARE_WORKAROUND,
> + pr_warn_once(FW_BUG
> "Your BIOS is broken; DMAR reported at address %llx%s!\n"
> "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
> addr, message,
> dmi_get_system_info(DMI_BIOS_VENDOR),
> dmi_get_system_info(DMI_BIOS_VERSION),
> dmi_get_system_info(DMI_PRODUCT_VERSION));
> + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
> }
>
> static int __ref
>
next prev parent reply other threads:[~2020-03-10 1:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 14:01 [PATCH 0/2] iommu/vt-d: replace WARN_TAINT with pr_warn + add_taint Hans de Goede
2020-03-09 14:01 ` [PATCH 1/2] iommu/vt-d: dmar: " Hans de Goede
2020-03-09 14:01 ` Hans de Goede
2020-03-10 1:44 ` Lu Baolu [this message]
2020-03-10 1:44 ` Lu Baolu
2020-03-09 14:01 ` [PATCH 2/2] iommu/vt-d: dmar_parse_one_rmrr: " Hans de Goede
2020-03-09 14:01 ` Hans de Goede
2020-03-09 15:57 ` Barret Rhoden via iommu
2020-03-09 15:57 ` Barret Rhoden
2020-03-09 16:01 ` Hans de Goede
2020-03-09 16:01 ` Hans de Goede
2020-03-09 16:11 ` Barret Rhoden via iommu
2020-03-09 16:11 ` Barret Rhoden
2020-03-10 1:44 ` Lu Baolu
2020-03-10 1:44 ` Lu Baolu
2020-03-10 10:42 ` [PATCH 0/2] iommu/vt-d: " Joerg Roedel
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=65bf12cc-0cf8-40e6-678b-b7b6775a3bf2@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=hdegoede@redhat.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--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 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.