From: Nathan Chancellor <nathan@kernel.org> To: Kees Cook <keescook@chromium.org> Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>, Nick Desaulniers <ndesaulniers@google.com>, Bill Wendling <morbo@google.com>, Justin Stitt <justinstitt@google.com>, linux-hardening@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hardening: Refresh KCFI options, add some more Date: Mon, 29 Apr 2024 15:16:50 -0700 [thread overview] Message-ID: <20240429221650.GA3666021@dev-arch.thelio-3990X> (raw) In-Reply-To: <20240426222940.work.884-kees@kernel.org> On Fri, Apr 26, 2024 at 03:29:44PM -0700, Kees Cook wrote: > Add some stuff that got missed along the way: > > - CONFIG_UNWIND_PATCH_PAC_INTO_SCS=y so SCS vs PAC is hardware > selectable. > > - CONFIG_X86_KERNEL_IBT=y while a default, just be sure. > > - CONFIG_CFI_CLANG=y for x86 and arm64. (And disable FINEIBT since > it isn't as secure as straight KCFI.) > > - CONFIG_PAGE_TABLE_CHECK=y for userspace mapping sanity. > > Signed-off-by: Kees Cook <keescook@chromium.org> Seems reasonable to me. Reviewed-by: Nathan Chancellor <nathan@kernel.org> One comment below. > --- > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: Will Deacon <will@kernel.org> > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: Ingo Molnar <mingo@redhat.com> > Cc: Borislav Petkov <bp@alien8.de> > Cc: Dave Hansen <dave.hansen@linux.intel.com> > Cc: x86@kernel.org > Cc: "H. Peter Anvin" <hpa@zytor.com> > Cc: Nathan Chancellor <nathan@kernel.org> > Cc: Nick Desaulniers <ndesaulniers@google.com> > Cc: Bill Wendling <morbo@google.com> > Cc: Justin Stitt <justinstitt@google.com> > Cc: linux-hardening@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: llvm@lists.linux.dev > --- > arch/arm64/configs/hardening.config | 5 +++++ > arch/x86/configs/hardening.config | 9 +++++++++ > kernel/configs/hardening.config | 4 ++++ > 3 files changed, 18 insertions(+) > > diff --git a/arch/arm64/configs/hardening.config b/arch/arm64/configs/hardening.config > index b0e795208998..e8a18fec7a3e 100644 > --- a/arch/arm64/configs/hardening.config > +++ b/arch/arm64/configs/hardening.config > @@ -5,6 +5,7 @@ CONFIG_ARM64_SW_TTBR0_PAN=y > > # Software Shadow Stack or PAC > CONFIG_SHADOW_CALL_STACK=y > +CONFIG_UNWIND_PATCH_PAC_INTO_SCS=y > > # Pointer authentication (ARMv8.3 and later). If hardware actually supports > # it, one can turn off CONFIG_STACKPROTECTOR_STRONG with this enabled. > @@ -20,3 +21,7 @@ CONFIG_ARM64_E0PD=y > > # Available in ARMv8.7 and later. > CONFIG_ARM64_EPAN=y > + > +# Enable Kernel Control Flow Integrity (currently Clang only). > +CONFIG_CFI_CLANG=y > +# CONFIG_CFI_PERMISSIVE is not set Should this be a part of kernel/configs/hardening.config because RISC-V supports it (and 32-bit ARM will soon too)? > diff --git a/arch/x86/configs/hardening.config b/arch/x86/configs/hardening.config > index 7b497f3b7bc3..b47e5f411dd3 100644 > --- a/arch/x86/configs/hardening.config > +++ b/arch/x86/configs/hardening.config > @@ -10,5 +10,14 @@ CONFIG_INTEL_IOMMU_DEFAULT_ON=y > CONFIG_INTEL_IOMMU_SVM=y > CONFIG_AMD_IOMMU=y > > +# Enforce CET Indirect Branch Tracking in the kernel. > +CONFIG_X86_KERNEL_IBT=y > + > +# Enable Kernel Control Flow Integrity (currently Clang only), but disable > +# weaker FINEIBT landing pads. > +CONFIG_CFI_CLANG=y > +# CONFIG_CFI_PERMISSIVE is not set > +# CONFIG_FINEIBT is not set > + > # Enable CET Shadow Stack for userspace. > CONFIG_X86_USER_SHADOW_STACK=y > diff --git a/kernel/configs/hardening.config b/kernel/configs/hardening.config > index 7a5bbfc024b7..4be0de1f085c 100644 > --- a/kernel/configs/hardening.config > +++ b/kernel/configs/hardening.config > @@ -23,6 +23,10 @@ CONFIG_SLAB_FREELIST_HARDENED=y > CONFIG_SHUFFLE_PAGE_ALLOCATOR=y > CONFIG_RANDOM_KMALLOC_CACHES=y > > +# Sanity check userspace page table mappings. > +CONFIG_PAGE_TABLE_CHECK=y > +CONFIG_PAGE_TABLE_CHECK_ENFORCED=y > + > # Randomize kernel stack offset on syscall entry. > CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y > > -- > 2.34.1 >
WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <nathan@kernel.org> To: Kees Cook <keescook@chromium.org> Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>, Nick Desaulniers <ndesaulniers@google.com>, Bill Wendling <morbo@google.com>, Justin Stitt <justinstitt@google.com>, linux-hardening@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hardening: Refresh KCFI options, add some more Date: Mon, 29 Apr 2024 15:16:50 -0700 [thread overview] Message-ID: <20240429221650.GA3666021@dev-arch.thelio-3990X> (raw) In-Reply-To: <20240426222940.work.884-kees@kernel.org> On Fri, Apr 26, 2024 at 03:29:44PM -0700, Kees Cook wrote: > Add some stuff that got missed along the way: > > - CONFIG_UNWIND_PATCH_PAC_INTO_SCS=y so SCS vs PAC is hardware > selectable. > > - CONFIG_X86_KERNEL_IBT=y while a default, just be sure. > > - CONFIG_CFI_CLANG=y for x86 and arm64. (And disable FINEIBT since > it isn't as secure as straight KCFI.) > > - CONFIG_PAGE_TABLE_CHECK=y for userspace mapping sanity. > > Signed-off-by: Kees Cook <keescook@chromium.org> Seems reasonable to me. Reviewed-by: Nathan Chancellor <nathan@kernel.org> One comment below. > --- > Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: Will Deacon <will@kernel.org> > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: Ingo Molnar <mingo@redhat.com> > Cc: Borislav Petkov <bp@alien8.de> > Cc: Dave Hansen <dave.hansen@linux.intel.com> > Cc: x86@kernel.org > Cc: "H. Peter Anvin" <hpa@zytor.com> > Cc: Nathan Chancellor <nathan@kernel.org> > Cc: Nick Desaulniers <ndesaulniers@google.com> > Cc: Bill Wendling <morbo@google.com> > Cc: Justin Stitt <justinstitt@google.com> > Cc: linux-hardening@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: llvm@lists.linux.dev > --- > arch/arm64/configs/hardening.config | 5 +++++ > arch/x86/configs/hardening.config | 9 +++++++++ > kernel/configs/hardening.config | 4 ++++ > 3 files changed, 18 insertions(+) > > diff --git a/arch/arm64/configs/hardening.config b/arch/arm64/configs/hardening.config > index b0e795208998..e8a18fec7a3e 100644 > --- a/arch/arm64/configs/hardening.config > +++ b/arch/arm64/configs/hardening.config > @@ -5,6 +5,7 @@ CONFIG_ARM64_SW_TTBR0_PAN=y > > # Software Shadow Stack or PAC > CONFIG_SHADOW_CALL_STACK=y > +CONFIG_UNWIND_PATCH_PAC_INTO_SCS=y > > # Pointer authentication (ARMv8.3 and later). If hardware actually supports > # it, one can turn off CONFIG_STACKPROTECTOR_STRONG with this enabled. > @@ -20,3 +21,7 @@ CONFIG_ARM64_E0PD=y > > # Available in ARMv8.7 and later. > CONFIG_ARM64_EPAN=y > + > +# Enable Kernel Control Flow Integrity (currently Clang only). > +CONFIG_CFI_CLANG=y > +# CONFIG_CFI_PERMISSIVE is not set Should this be a part of kernel/configs/hardening.config because RISC-V supports it (and 32-bit ARM will soon too)? > diff --git a/arch/x86/configs/hardening.config b/arch/x86/configs/hardening.config > index 7b497f3b7bc3..b47e5f411dd3 100644 > --- a/arch/x86/configs/hardening.config > +++ b/arch/x86/configs/hardening.config > @@ -10,5 +10,14 @@ CONFIG_INTEL_IOMMU_DEFAULT_ON=y > CONFIG_INTEL_IOMMU_SVM=y > CONFIG_AMD_IOMMU=y > > +# Enforce CET Indirect Branch Tracking in the kernel. > +CONFIG_X86_KERNEL_IBT=y > + > +# Enable Kernel Control Flow Integrity (currently Clang only), but disable > +# weaker FINEIBT landing pads. > +CONFIG_CFI_CLANG=y > +# CONFIG_CFI_PERMISSIVE is not set > +# CONFIG_FINEIBT is not set > + > # Enable CET Shadow Stack for userspace. > CONFIG_X86_USER_SHADOW_STACK=y > diff --git a/kernel/configs/hardening.config b/kernel/configs/hardening.config > index 7a5bbfc024b7..4be0de1f085c 100644 > --- a/kernel/configs/hardening.config > +++ b/kernel/configs/hardening.config > @@ -23,6 +23,10 @@ CONFIG_SLAB_FREELIST_HARDENED=y > CONFIG_SHUFFLE_PAGE_ALLOCATOR=y > CONFIG_RANDOM_KMALLOC_CACHES=y > > +# Sanity check userspace page table mappings. > +CONFIG_PAGE_TABLE_CHECK=y > +CONFIG_PAGE_TABLE_CHECK_ENFORCED=y > + > # Randomize kernel stack offset on syscall entry. > CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y > > -- > 2.34.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-04-29 22:16 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-26 22:29 [PATCH] hardening: Refresh KCFI options, add some more Kees Cook 2024-04-26 22:29 ` Kees Cook 2024-04-29 22:16 ` Nathan Chancellor [this message] 2024-04-29 22:16 ` Nathan Chancellor 2024-04-30 5:35 ` Kees Cook 2024-04-30 5:35 ` Kees Cook 2024-04-30 15:12 ` Nathan Chancellor 2024-04-30 15:12 ` Nathan Chancellor 2024-04-30 9:21 ` Peter Zijlstra 2024-04-30 9:21 ` Peter Zijlstra 2024-04-30 17:48 ` Kees Cook 2024-04-30 17:48 ` Kees Cook 2024-04-30 21:15 ` Kees Cook 2024-04-30 21:15 ` Kees Cook 2024-04-30 21:25 ` Kees Cook 2024-04-30 21:25 ` Kees Cook 2024-05-01 11:06 ` Peter Zijlstra 2024-05-01 11:06 ` Peter Zijlstra 2024-05-01 19:27 ` Kees Cook 2024-05-01 19:27 ` Kees Cook
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=20240429221650.GA3666021@dev-arch.thelio-3990X \ --to=nathan@kernel.org \ --cc=bp@alien8.de \ --cc=catalin.marinas@arm.com \ --cc=dave.hansen@linux.intel.com \ --cc=gustavoars@kernel.org \ --cc=hpa@zytor.com \ --cc=justinstitt@google.com \ --cc=keescook@chromium.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-hardening@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=llvm@lists.linux.dev \ --cc=mingo@redhat.com \ --cc=morbo@google.com \ --cc=ndesaulniers@google.com \ --cc=tglx@linutronix.de \ --cc=will@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.