All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Borislav Petkov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	aravind.gopalakrishnan@amd.com, tglx@linutronix.de,
	hpa@linux.intel.com, bp@suse.de
Subject: [tip:x86/urgent] x86, cpu, amd: Add workaround for family 16h, erratum 793
Date: Tue, 14 Jan 2014 16:45:38 -0800	[thread overview]
Message-ID: <tip-3b56496865f9f7d9bcb2f93b44c63f274f08e3b6@git.kernel.org> (raw)
In-Reply-To: <20140114230711.GS29865@pd.tnic>

Commit-ID:  3b56496865f9f7d9bcb2f93b44c63f274f08e3b6
Gitweb:     http://git.kernel.org/tip/3b56496865f9f7d9bcb2f93b44c63f274f08e3b6
Author:     Borislav Petkov <bp@suse.de>
AuthorDate: Wed, 15 Jan 2014 00:07:11 +0100
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Tue, 14 Jan 2014 16:39:07 -0800

x86, cpu, amd: Add workaround for family 16h, erratum 793

This adds the workaround for erratum 793 as a precaution in case not
every BIOS implements it.  This addresses CVE-2013-6885.

Erratum text:

[Revision Guide for AMD Family 16h Models 00h-0Fh Processors,
document 51810 Rev. 3.04 November 2013]

793 Specific Combination of Writes to Write Combined Memory Types and
Locked Instructions May Cause Core Hang

Description

Under a highly specific and detailed set of internal timing
conditions, a locked instruction may trigger a timing sequence whereby
the write to a write combined memory type is not flushed, causing the
locked instruction to stall indefinitely.

Potential Effect on System

Processor core hang.

Suggested Workaround

BIOS should set MSR
C001_1020[15] = 1b.

Fix Planned

No fix planned

[ hpa: updated description, fixed typo in MSR name ]

Signed-off-by: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/20140114230711.GS29865@pd.tnic
Tested-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/include/uapi/asm/msr-index.h |  1 +
 arch/x86/kernel/cpu/amd.c             | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h
index 37813b5..59cea18 100644
--- a/arch/x86/include/uapi/asm/msr-index.h
+++ b/arch/x86/include/uapi/asm/msr-index.h
@@ -184,6 +184,7 @@
 #define MSR_AMD64_PATCH_LOADER		0xc0010020
 #define MSR_AMD64_OSVW_ID_LENGTH	0xc0010140
 #define MSR_AMD64_OSVW_STATUS		0xc0010141
+#define MSR_AMD64_LS_CFG		0xc0011020
 #define MSR_AMD64_DC_CFG		0xc0011022
 #define MSR_AMD64_BU_CFG2		0xc001102a
 #define MSR_AMD64_IBSFETCHCTL		0xc0011030
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index bca023b..59bfebc 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -508,6 +508,16 @@ static void early_init_amd(struct cpuinfo_x86 *c)
 			set_cpu_cap(c, X86_FEATURE_EXTD_APICID);
 	}
 #endif
+
+	/* F16h erratum 793, CVE-2013-6885 */
+	if (c->x86 == 0x16 && c->x86_model <= 0xf) {
+		u64 val;
+
+		rdmsrl(MSR_AMD64_LS_CFG, val);
+		if (!(val & BIT(15)))
+			wrmsrl(MSR_AMD64_LS_CFG, val | BIT(15));
+	}
+
 }
 
 static const int amd_erratum_383[];

  parent reply	other threads:[~2014-01-15  0:45 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14 11:41 AMD errata 793 (CVE-2013-6885) needs a workaround in Linux? Henrique de Moraes Holschuh
2014-01-14 11:55 ` Borislav Petkov
2014-01-14 15:14   ` H. Peter Anvin
2014-01-14 15:35     ` Borislav Petkov
2014-01-14 16:27       ` [PATCH] x86, CPU, AMD: Add workaround for family 16h, erratum 793 Borislav Petkov
2014-01-14 16:30         ` H. Peter Anvin
2014-01-14 16:42           ` Borislav Petkov
2014-01-14 17:46             ` H. Peter Anvin
2014-01-14 23:07               ` [PATCH -v1.1] " Borislav Petkov
2014-01-15  0:38                 ` H. Peter Anvin
2014-01-15 11:10                   ` [PATCH -v1.2] " Borislav Petkov
2014-01-15  0:45                 ` tip-bot for Borislav Petkov [this message]
2014-01-15  0:54                   ` [tip:x86/urgent] x86, cpu, amd: " H. Peter Anvin
2014-01-15  6:28                     ` Ingo Molnar
2014-01-15 13:36                       ` Borislav Petkov
2014-01-15 13:52                         ` H. Peter Anvin
2014-01-15 18:38                           ` Ingo Molnar
2014-01-16  4:11                             ` H. Peter Anvin
     [not found]         ` <52D59ACC.3090100@amd.com>
2014-01-14 20:38           ` [PATCH] x86, CPU, AMD: " Borislav Petkov
2014-01-16 17:58             ` Aravind Gopalakrishnan
2014-01-16 18:10               ` Borislav Petkov
2014-01-17  0:21               ` Henrique de Moraes Holschuh
2014-01-17  0:25                 ` H. Peter Anvin
2014-01-17 10:18                 ` Borislav Petkov
2014-01-17 16:23                   ` H. Peter Anvin
2014-01-17 17:02                     ` Borislav Petkov
2014-01-17 17:36                       ` Aravind Gopalakrishnan
2014-01-17 17:42                       ` H. Peter Anvin
2014-01-17 18:05                         ` Aravind Gopalakrishnan
2014-01-17 18:25                           ` Borislav Petkov
2014-01-17 22:28         ` Pavel Machek
2014-01-17 22:50           ` Borislav Petkov
2014-01-17 22:51             ` H. Peter Anvin
2014-01-17 22:57               ` Borislav Petkov
2014-01-18  0:29               ` Pavel Machek
2014-01-18  1:21                 ` H. Peter Anvin
2014-01-18  2:01                   ` Pavel Machek
2014-01-18 10:42                     ` Borislav Petkov
2014-01-18 11:08                       ` Pavel Machek
2014-01-18 11:26                         ` Borislav Petkov
2014-01-18 11:31                           ` Pavel Machek

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=tip-3b56496865f9f7d9bcb2f93b44c63f274f08e3b6@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=aravind.gopalakrishnan@amd.com \
    --cc=bp@suse.de \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /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.