From: tip-bot for Lukasz Odzioba <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, bp@suse.de, tglx@linutronix.de,
hpa@zytor.com, torvalds@linux-foundation.org, mingo@kernel.org,
linux-kernel@vger.kernel.org, lukasz.odzioba@intel.com
Subject: [tip:x86/urgent] x86/cpu: Fix bootup crashes by sanitizing the argument of the 'clearcpuid=' command-line option
Date: Thu, 5 Jan 2017 07:04:49 -0800 [thread overview]
Message-ID: <tip-dd853fd216d1485ed3045ff772079cc8689a9a4a@git.kernel.org> (raw)
In-Reply-To: <1482933340-11857-1-git-send-email-lukasz.odzioba@intel.com>
Commit-ID: dd853fd216d1485ed3045ff772079cc8689a9a4a
Gitweb: http://git.kernel.org/tip/dd853fd216d1485ed3045ff772079cc8689a9a4a
Author: Lukasz Odzioba <lukasz.odzioba@intel.com>
AuthorDate: Wed, 28 Dec 2016 14:55:40 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 5 Jan 2017 08:54:34 +0100
x86/cpu: Fix bootup crashes by sanitizing the argument of the 'clearcpuid=' command-line option
A negative number can be specified in the cmdline which will be used as
setup_clear_cpu_cap() argument. With that we can clear/set some bit in
memory predceeding boot_cpu_data/cpu_caps_cleared which may cause kernel
to misbehave. This patch adds lower bound check to setup_disablecpuid().
Boris Petkov reproduced a crash:
[ 1.234575] BUG: unable to handle kernel paging request at ffffffff858bd540
[ 1.236535] IP: memcpy_erms+0x6/0x10
Signed-off-by: Lukasz Odzioba <lukasz.odzioba@intel.com>
Acked-by: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: andi.kleen@intel.com
Cc: bp@alien8.de
Cc: dave.hansen@linux.intel.com
Cc: luto@kernel.org
Cc: slaoub@gmail.com
Fixes: ac72e7888a61 ("x86: add generic clearcpuid=... option")
Link: http://lkml.kernel.org/r/1482933340-11857-1-git-send-email-lukasz.odzioba@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/cpu/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index dc1697c..9bab7a8 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1221,7 +1221,7 @@ static __init int setup_disablecpuid(char *arg)
{
int bit;
- if (get_option(&arg, &bit) && bit < NCAPINTS*32)
+ if (get_option(&arg, &bit) && bit >= 0 && bit < NCAPINTS * 32)
setup_clear_cpu_cap(bit);
else
return 0;
prev parent reply other threads:[~2017-01-05 15:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-28 13:55 [PATCH 1/1] x86: sanitize argument of clearcpuid command-line option Lukasz Odzioba
2016-12-29 10:21 ` Borislav Petkov
2017-01-05 7:55 ` Ingo Molnar
2017-01-16 18:50 ` Odzioba, Lukasz
2017-01-17 7:17 ` Ingo Molnar
2017-01-18 9:52 ` Odzioba, Lukasz
2017-01-05 15:04 ` tip-bot for Lukasz Odzioba [this message]
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-dd853fd216d1485ed3045ff772079cc8689a9a4a@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=lukasz.odzioba@intel.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).