RE: [RFC PATCH 00/56] Dynamic mitigations

Kaplan, David
2025-10-16T13:42:45Z

[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Nicolas Bouchinet <nicolas.bouchinet@oss.cyber.gouv.fr>
> Sent: Thursday, October 16, 2025 5:00 AM
> To: Kaplan, David <David.Kaplan@amd.com>
> Cc: Josh Poimboeuf <jpoimboe@kernel.org>; Aaron Rainbolt
> <arraybolt3@gmail.com>; Thomas Gleixner <tglx@linutronix.de>; Borislav Petkov
> <bp@alien8.de>; Peter Zijlstra <peterz@infradead.org>; Pawan Gupta
> <pawan.kumar.gupta@linux.intel.com>; Ingo Molnar <mingo@redhat.com>; Dave
> Hansen <dave.hansen@linux.intel.com>; x86@kernel.org; H . Peter Anvin
> <hpa@zytor.com>; Alexander Graf <graf@amazon.com>; Boris Ostrovsky
> <boris.ostrovsky@oracle.com>; linux-kernel@vger.kernel.org; Xiujianfeng
> <xiujianfeng@huawei.com>; xiujianfeng@huaweicloud.com
> Subject: Re: [RFC PATCH 00/56] Dynamic mitigations
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Hi David,
>
> > > > > On Wed, Oct 15, 2025 at 01:53:31PM +0000, Kaplan, David wrote:
> > > > > > > If `root` is capable of setting `mitigations=off` via this interface,
> > > > > > > doesn't that somewhat defeat the purpose of denying `/proc/kcore`
> > > > > > > access in lockdown confidentiality mode? Assuming one is running on a
> > > > > > > CPU with some form of side-channel memory read vulnerability (which
> they
> > > > > > > very likely are), they can turn off all mitigations, then read kernel
> > > > > > > memory via one of those exploits.
> > > > > > >
> > > > > > > There should be a one-way switch to allow denying all further writes to
> > > > > > > this interface, so that once the system's mitigations are set properly,
> > > > > > > any further attempts to change them until the next reboot can be
> > > > > > > prevented.
> > > > > > >
> > > > > >
> > > > > > That's a good idea, there could be a separate mitigation_lock file
> > > > > > perhaps that once written to 1 denies any further changes.
> > > > >
> > > > > Wouldn't the enablement of lockdown mode effectively function as that
> > > > > one way switch?
> > > > >
> > > >
> > > > I'm not too familiar with lockdown mode, but that gets enabled (with
> > > > right cmdline options) during boot right? I guess the question is
> > > > would we want to allow any window for userspace to reconfigure things
> > > > and then lock things down, or say that if you enable lockdown then
> > > > this interface is completely disabled and you need to specify your
> > > > mitigation options on the cmdline only.
> > >
> > > Yeah, I would say the latter, otherwise it defeats the point of lockdown
> > > mode. Note that lockdown mode can also be enabled at runtime.
> > >
> >
> > Ok. So that's using the security_locked_down() API presumably. And what
> reason would we want to check for? Should it be LOCKDOWN_DEV_MEM (since
> we're potentially leaking arbitrary memory)? Or a new lockdown reason?
> >
> > --David Kaplan
>
> LOCKDOWN_DEV_MEM is an integrity reason and should not be used for this
> scenario.
> I'd rather like to add a new Lockdown reason in the confidentiality set,
> maybe LOCKDOWN_CPU_MITIGATION ?
>

Ok, that makes sense. Just to clarify, would that mean something like the below:

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 3f9410dee67c..9b4864f84146 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -691,6 +691,9 @@ ssize_t cpu_write_mitigation_options(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
+ if (security_locked_down(LOCKDOWN_CPU_MITIGATIONS))
+ return -EPERM;
+
/* Save and filter the provided options. */
cpu_filter_mitigation_opts(buf);

diff --git a/include/linux/security.h b/include/linux/security.h
index 92ac3f27b973..81cb52cf2111 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -153,6 +153,7 @@ enum lockdown_reason {
LOCKDOWN_TRACEFS,
LOCKDOWN_XMON_RW,
LOCKDOWN_XFRM_SECRET,
+ LOCKDOWN_CPU_MITIGATIONS,
LOCKDOWN_CONFIDENTIALITY_MAX,
};