[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <745eaeb668bc43deb8eb7db7a3342691@intel.com>
Date: Mon, 29 Mar 2021 16:12:16 +0000
From: "Luck, Tony" <tony.luck@...el.com>
To: Yang Li <yang.lee@...ux.alibaba.com>
CC: "bp@...en8.de" <bp@...en8.de>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"x86@...nel.org" <x86@...nel.org>, "hpa@...or.com" <hpa@...or.com>,
"linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] x86/mce/dev-mcelog: Fix potential memory access error
- set_bit(MCE_OVERFLOW, (unsigned long *)&mcelog->flags);
+ mcelog->flags |= BIT(MCE_OVERFLOW);
set_bit() is an atomic operation because it might race with the code to
get and clear this bit:
do {
flags = mcelog->flags;
} while (cmpxchg(&mcelog->flags, flags, 0) != flags);
Originally this was needed because mcelog could be called from #MC
context.
That's all changed now and the machine check notifier chain routines are
called in a kernel thread. So some other locking (mutex?) could be used
to protect access to mcelog->flags.
-Tony
Powered by blists - more mailing lists