Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp581989ybl; Tue, 7 Jan 2020 11:18:39 -0800 (PST) X-Google-Smtp-Source: APXvYqyqWOW49EER8OcLJJBgBYod5s+Uf5lyhHmgw1PVYuHJBC1xgH1n6icWxnbXA54I6K4vI0n3 X-Received: by 2002:a9d:5786:: with SMTP id q6mr1314268oth.164.1578424719200; Tue, 07 Jan 2020 11:18:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578424719; cv=none; d=google.com; s=arc-20160816; b=MTSsdUcXo2Si8Kt4l5WJyPQq7bpceDI8F7xZUSr1klj0yEi4CuAzDspYJg9cgZQZs4 rGhULikzDSvqPwBP/3kTkF9PpoANQ7dg06f1em1c55Mi4rs27isEIhmr3Nqip+OXpJB1 KCwCWCmqFmh+bvpg0XBUWfaU21rjNJulw7a7q8La7XXYE18qYM4ZgfXkspk8gLdCmk8R fn33zzSL+wJiYI3JCk5UXaj+QA3L7rQKB74sUOS6LomH0/bL139LAYTj2/9dhaNQByoE OOzaGplFrQtAc9vt1j5ssGA0LTUmZrxU0SrWCbppY04RRRKJYEw41oz1rufphiwD0Ers 3Aow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=0CZJko/qdfQtke3cSJ7hp5iCIDiC0gTMp9RSBpUuJOk=; b=cOAExPCZG4dbLNslgeJLIQCm705S9i0O9TAcVcFZwVNzbN2kbjZ5ORg83fqmZhMeJH zEnVTwFQG+SzjDkpqW0ul9N++LMxNQJhQcoALLt+O7sDb8oDDwU6BDQR66EJKajjxMkt fYZOuiuDQeGlEwAGyB4rfE+mouI3gwqF8FeBjfqtBlwXLYBXWHHIi3Z6zxZl1OM17IGn +TxAAFON+26L7E26y3u9HjDDvEYGrcq+Ni9c68pw0+sjO3HjVwaoJER8V0emDPYpabTD 8M5PQ49nMO3nodjZUfAJpSpGzIyGHSZdgcvQYTQujQZD/nSyb35ANgtcGDlFiy+qsC+R d1tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rTG3oakS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si443106oia.232.2020.01.07.11.18.27; Tue, 07 Jan 2020 11:18:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rTG3oakS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728837AbgAGTQ1 (ORCPT + 99 others); Tue, 7 Jan 2020 14:16:27 -0500 Received: from mail-qk1-f202.google.com ([209.85.222.202]:41368 "EHLO mail-qk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728540AbgAGTQ1 (ORCPT ); Tue, 7 Jan 2020 14:16:27 -0500 Received: by mail-qk1-f202.google.com with SMTP id l7so450969qke.8 for ; Tue, 07 Jan 2020 11:16:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=0CZJko/qdfQtke3cSJ7hp5iCIDiC0gTMp9RSBpUuJOk=; b=rTG3oakSdnKidDuXwG4ZZs5fx3OQ+4GtXtAX3iWIs4Z9OLjOUGTuyOkhixGJ5wjqin jB9KfpGs26CsfP3NsA1aA/3ekAszm7fbstk9CB6gzSN5cbPzbhxca94l/V6O1Jmd2ouJ JGXH5EXr6vE+59a7yJehUo84xKsWJfzBSbaqiT6Jl6wDlufqvPj89kBecDvM1wZ2rQCG a2qzC6LTkRePvRi/b3RKNPRDPMkK+EyoIIYHT4yDs7ov6F43GSg13PkleH260MxdgPWj nZZ/yyWu/5Hg1fg3o/COD+Y7CNb3jUIzpLumKyILA9SjoEF5cymE6PAGeiOYf+0w4Amo 9RCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=0CZJko/qdfQtke3cSJ7hp5iCIDiC0gTMp9RSBpUuJOk=; b=EvwFH1hLSS0t0hdTBehMKWA/vjap8huB4XY0c5ubMADhH7RWB1/DJEEMI9kHncitOp h3Pmp5vn9CqJaWEAPCNl6I4mJPF2W0BazOTVRI8NyurUoSGFg6S4iweuOEpR/RGYjCVV rnEZXhD8aIo/kumEXM/fAL3BM4049jDOZjNa9/ZXyS7boW2YX9s2IuKvnxG+L5V06FPz oqNQUIGkEunq7MY9Vn2vJTwZUZTG6iNr88tFaBVLdVr4rnBOOY/ilxfwPm/PNdn2nYKe 7bVuXCXyKYygNX59TEMJB2VHjA/7OEy+OU/BILiMk5Jyv5fQL9Cq47QkRn0wDPdqbNzM 2IYg== X-Gm-Message-State: APjAAAVOcnFewWuoJHBYquAod11hgDzXQtRSqSO0YbnugP49R7R81lae lfsS7PmJTKWOjKtS3uacI53WN/R+ X-Received: by 2002:a37:801:: with SMTP id 1mr885696qki.326.1578424585781; Tue, 07 Jan 2020 11:16:25 -0800 (PST) Date: Tue, 7 Jan 2020 14:16:09 -0500 In-Reply-To: <20200107191610.178185-1-brho@google.com> Message-Id: <20200107191610.178185-2-brho@google.com> Mime-Version: 1.0 References: <20200107191610.178185-1-brho@google.com> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog Subject: [PATCH v2 1/2] iommu/vt-d: skip RMRR entries that fail the sanity check From: Barret Rhoden To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , David Woodhouse , Joerg Roedel , Yian Chen , Sohil Mehta Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, x86@kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RMRR entries describe memory regions that are DMA targets for devices outside the kernel's control. RMRR entries that fail the sanity check are pointing to regions of memory that the firmware did not tell the kernel are reserved or otherwise should not be used. Instead of aborting DMAR processing, this commit skips these RMRR entries and marks the firmware as tainted. They will not be mapped into the IOMMU, but the IOMMU can still be utilized. If anything, when the IOMMU is on, those devices will not be able to clobber RAM that the kernel has allocated from those regions. Signed-off-by: Barret Rhoden --- drivers/iommu/intel-iommu.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 0c8d81f56a30..a8bb458845bc 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -4319,12 +4319,18 @@ int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg) { struct acpi_dmar_reserved_memory *rmrr; struct dmar_rmrr_unit *rmrru; - int ret; rmrr = (struct acpi_dmar_reserved_memory *)header; - ret = arch_rmrr_sanity_check(rmrr); - if (ret) - return ret; + if (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", + rmrr->base_address, rmrr->end_address, + dmi_get_system_info(DMI_BIOS_VENDOR), + dmi_get_system_info(DMI_BIOS_VERSION), + dmi_get_system_info(DMI_PRODUCT_VERSION)); + return 0; + } rmrru = kzalloc(sizeof(*rmrru), GFP_KERNEL); if (!rmrru) -- 2.24.1.735.g03f4e72817-goog