From: Mathias Krause <minipli@grsecurity.net>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org,
Mathias Krause <minipli@grsecurity.net>
Subject: [PATCH v2] x86/shstk: Provide kernel command line knob to disable
Date: Thu, 2 Apr 2026 19:36:05 +0200 [thread overview]
Message-ID: <20260402173606.1096172-1-minipli@grsecurity.net> (raw)
Provide a kernel command line option 'shstk=off' to disable CET shadow
stacks, much like 'ibt=off' can be used to disable CET IBT.
With both set to off, it avoids setting CR4.CET on capable hardware to
allow debugging related issues during early boot which I happened to
have done way too many times in the recent past.
Document it along with its sibling option 'ibt' in kernel-parameters.txt
to allow others to find it more easily.
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
---
v2:
- pick up Ack's
- document the new option as well as ibt=
- tweak changelog accordingly
Documentation/admin-guide/kernel-parameters.txt | 14 ++++++++++++++
arch/x86/kernel/shstk.c | 9 +++++++++
2 files changed, 23 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 03a550630644..43bdf72f6495 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2248,6 +2248,16 @@ Kernel parameters
syscalls, essentially overriding IA32_EMULATION_DEFAULT_DISABLED at
boot time. When false, unconditionally disables IA32 emulation.
+ ibt= [X86-64]
+ Format: ibt=warn, ibt=off
+ Changes the handling of CET IBT violations in the kernel.
+
+ The 'warn' setting makes CET IBT violations emit a
+ warning only instead of being fatal while the 'off'
+ setting completely disables CET IBT for the kernel.
+
+ To fully disable CET, use 'ibt=off shstk=off'.
+
icn= [HW,ISDN]
Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]]
@@ -6924,6 +6934,10 @@ Kernel parameters
Specify the MCLK divider for Intel SoundWire buses in
case the BIOS does not provide the clock rate properly.
+ shstk=off [X86-64] Disable CET userspace shadow stack support.
+
+ To fully disable CET, use 'ibt=off shstk=off'.
+
skew_tick= [KNL,EARLY] Offset the periodic timer tick per cpu to mitigate
xtime_lock contention on larger systems, and/or RCU lock
contention on all systems with CONFIG_MAXSMP set.
diff --git a/arch/x86/kernel/shstk.c b/arch/x86/kernel/shstk.c
index 978232b6d48d..68b46bf1540b 100644
--- a/arch/x86/kernel/shstk.c
+++ b/arch/x86/kernel/shstk.c
@@ -542,6 +542,15 @@ static int shstk_disable(void)
return 0;
}
+static int __init shstk_configure(char *str)
+{
+ if (!strcmp(str, "off"))
+ setup_clear_cpu_cap(X86_FEATURE_SHSTK);
+
+ return 1;
+}
+__setup("shstk=", shstk_configure);
+
SYSCALL_DEFINE3(map_shadow_stack, unsigned long, addr, unsigned long, size, unsigned int, flags)
{
bool set_tok = flags & SHADOW_STACK_SET_TOKEN;
--
2.47.3
next reply other threads:[~2026-04-02 17:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 17:36 Mathias Krause [this message]
2026-05-04 12:09 ` Mathias Krause
2026-05-06 19:03 ` Dave Hansen
2026-05-06 22:45 ` Edgecombe, Rick P
2026-05-07 13:39 ` Mathias Krause
2026-05-07 19:53 ` Edgecombe, Rick P
2026-05-08 7:23 ` Mathias Krause
2026-05-08 16:34 ` Dave Hansen
2026-05-11 5:04 ` Mathias Krause
2026-05-08 16:35 ` Edgecombe, Rick P
2026-05-13 20:51 ` Mathias Krause
2026-05-14 0:31 ` Edgecombe, Rick P
2026-05-14 16:14 ` Mathias Krause
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=20260402173606.1096172-1-minipli@grsecurity.net \
--to=minipli@grsecurity.net \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=tglx@kernel.org \
--cc=x86@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
all inboxes | Powered by JetHome®