linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] x86/RAS: Some small things for tip
@ 2016-04-06  8:05 Borislav Petkov
  2016-04-06  8:05 ` [PATCH 1/3] x86/RAS: Rename AMD MCE injectior config item Borislav Petkov
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Borislav Petkov @ 2016-04-06  8:05 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

Hi,

just a couple of smallish fixes. Tony's is CC:stable so please queue
this into tip:x86/urgent.

Thanks.

Borislav Petkov (1):
  x86/RAS: Rename AMD MCE injectior config item

Davidlohr Bueso (1):
  x86/mce: Remove explicit smp_rmb() when starting CPUs sync

Tony Luck (1):
  x86/mce: Avoid using object after free in genpool

 arch/x86/kernel/cpu/mcheck/mce-genpool.c | 4 ++--
 arch/x86/kernel/cpu/mcheck/mce.c         | 4 ++--
 arch/x86/ras/Kconfig                     | 2 +-
 arch/x86/ras/Makefile                    | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.7.3

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH] x86/mce: Avoid using object after free in genpool.
@ 2016-03-23 16:14 Tony Luck
  2016-03-23 17:33 ` Borislav Petkov
  0 siblings, 1 reply; 12+ messages in thread
From: Tony Luck @ 2016-03-23 16:14 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: linux-kernel, Chen, Gong

When we loop over all queued machine check error records to pass
them to the registered notifiers we use llist_for_each_entry().
But the loop calls gen_pool_free() for the entry in the body of
the loop - and then the iterator looks at node->next after the
free.

Use llist_for_each_entry_safe() instead.

Cc: stable@vger.kernel.org
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 arch/x86/kernel/cpu/mcheck/mce-genpool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce-genpool.c b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
index 0a850100c594..2658e2af74ec 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-genpool.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
@@ -29,7 +29,7 @@ static char gen_pool_buf[MCE_POOLSZ];
 void mce_gen_pool_process(void)
 {
 	struct llist_node *head;
-	struct mce_evt_llist *node;
+	struct mce_evt_llist *node, *tmp;
 	struct mce *mce;
 
 	head = llist_del_all(&mce_event_llist);
@@ -37,7 +37,7 @@ void mce_gen_pool_process(void)
 		return;
 
 	head = llist_reverse_order(head);
-	llist_for_each_entry(node, head, llnode) {
+	llist_for_each_entry_safe(node, tmp, head, llnode) {
 		mce = &node->mce;
 		atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, mce);
 		gen_pool_free(mce_evt_pool, (unsigned long)node, sizeof(*node));
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [PATCH -tip] x86/mce: Use atomic_inc_return barrier when starting monad sync
@ 2016-03-21 23:19 Davidlohr Bueso
  2016-03-23  8:30 ` Borislav Petkov
  0 siblings, 1 reply; 12+ messages in thread
From: Davidlohr Bueso @ 2016-03-21 23:19 UTC (permalink / raw)
  To: bp, tony.luck, mingo; +Cc: linux-kernel, dave, Davidlohr Bueso

mce_start() has an explicit smp_wmb to serialize writes to
global_nwo and mce_callin. However, atomic_inc_return() implies
barriers on both sides of the call, as such simply rely on this
full smp barrier.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 arch/x86/kernel/cpu/mcheck/mce.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index f0c921b03e42..6b7039c166b8 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -830,9 +830,9 @@ static int mce_start(int *no_way_out)
 
 	atomic_add(*no_way_out, &global_nwo);
 	/*
-	 * global_nwo should be updated before mce_callin
+	 * Rely on the implied barrier below, such that global_nwo
+	 * is updated before mce_callin.
 	 */
-	smp_wmb();
 	order = atomic_inc_return(&mce_callin);
 
 	/*
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-04-13 11:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06  8:05 [PATCH 0/3] x86/RAS: Some small things for tip Borislav Petkov
2016-04-06  8:05 ` [PATCH 1/3] x86/RAS: Rename AMD MCE injectior config item Borislav Petkov
2016-04-13 11:35   ` [tip:ras/core] x86/RAS: Rename AMD MCE injector " tip-bot for Borislav Petkov
2016-04-06  8:05 ` [PATCH 2/3] x86/mce: Remove explicit smp_rmb() when starting CPUs sync Borislav Petkov
2016-04-13 11:35   ` [tip:ras/core] " tip-bot for Davidlohr Bueso
2016-04-06  8:05 ` [PATCH 3/3] x86/mce: Avoid using object after free in genpool Borislav Petkov
2016-04-13 11:35   ` [tip:ras/core] " tip-bot for Tony Luck
  -- strict thread matches above, loose matches on Subject: below --
2016-03-23 16:14 [PATCH] " Tony Luck
2016-03-23 17:33 ` Borislav Petkov
2016-03-23 20:47   ` Luck, Tony
2016-03-21 23:19 [PATCH -tip] x86/mce: Use atomic_inc_return barrier when starting monad sync Davidlohr Bueso
2016-03-23  8:30 ` Borislav Petkov

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).