stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Quentin Casasnovas <quentin.casasnovas@oracle.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Fenghua Yu <fenghua.yu@intel.com>, Borislav Petkov <bp@suse.de>,
	Jiri Slaby <jslaby@suse.cz>, Sheng Yong <shengyong1@huawei.com>
Subject: [PATCH 3.10 14/22] x86/microcode/intel: Guard against stack overflow in the loader
Date: Wed,  1 Jul 2015 11:40:19 -0700	[thread overview]
Message-ID: <20150701183942.578303031@linuxfoundation.org> (raw)
In-Reply-To: <20150701183942.019582154@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Quentin Casasnovas <quentin.casasnovas@oracle.com>

commit f84598bd7c851f8b0bf8cd0d7c3be0d73c432ff4 upstream.

mc_saved_tmp is a static array allocated on the stack, we need to make
sure mc_saved_count stays within its bounds, otherwise we're overflowing
the stack in _save_mc(). A specially crafted microcode header could lead
to a kernel crash or potentially kernel execution.

Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Link: http://lkml.kernel.org/r/1422964824-22056-1-git-send-email-quentin.casasnovas@oracle.com
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kernel/microcode_intel_early.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/kernel/microcode_intel_early.c
+++ b/arch/x86/kernel/microcode_intel_early.c
@@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, un
 	unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
 	int i;
 
-	while (leftover) {
+	while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
 		mc_header = (struct microcode_header_intel *)ucode_ptr;
 
 		mc_size = get_totalsize(mc_header);



  parent reply	other threads:[~2015-07-01 18:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01 18:40 [PATCH 3.10 00/22] 3.10.83-stable review Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 01/22] fput: turn "list_head delayed_fput_list" into llist_head Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 02/22] get rid of s_files and files_lock Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 03/22] config: Enable NEED_DMA_MAP_STATE by default when SWIOTLB is selected Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 05/22] netfilter: Zero the tuple in nfnl_cthelper_parse_tuple() Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 06/22] include/linux/sched.h: dont use task->pid/tgid in same_thread_group/has_group_leader_pid Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 07/22] __ptrace_may_access() should not deny sub-threads Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 08/22] ACPICA: Utilities: Cleanup to convert physical address printing formats Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 09/22] ACPICA: Utilities: Cleanup to remove useless ACPI_PRINTF/FORMAT_xxx helpers Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 10/22] sb_edac: Fix erroneous bytes->gigabytes conversion Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 11/22] hpsa: refine the pci enable/disable handling Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 12/22] hpsa: add missing pci_set_master in kdump path Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 13/22] fs: take i_mutex during prepare_binprm for set[ug]id executables Greg Kroah-Hartman
2015-07-01 18:40 ` Greg Kroah-Hartman [this message]
2015-07-01 18:40 ` [PATCH 3.10 15/22] Btrfs: make xattr replace operations atomic Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 16/22] xfrm: Increase the garbage collector threshold Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 19/22] Re: [PATCH 3.10 14/46] d_walk() might skip too much Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 20/22] ARM: clk-imx6q: refine satas parent Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 21/22] KVM: nSVM: Check for NRIPS support before updating control field Greg Kroah-Hartman
2015-07-01 18:40 ` [PATCH 3.10 22/22] bus: mvebu: pass the coherency availability information at init time Greg Kroah-Hartman
2015-07-01 20:31 ` [PATCH 3.10 00/22] 3.10.83-stable review Guenter Roeck
2015-07-01 20:41   ` Greg Kroah-Hartman
2015-07-01 22:35 ` Shuah Khan
2015-07-01 23:17   ` Greg Kroah-Hartman

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=20150701183942.578303031@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bp@suse.de \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quentin.casasnovas@oracle.com \
    --cc=shengyong1@huawei.com \
    --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 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).