[PATCH 4.14 05/40] efi/libstub: Disable Shadow Call Stack

Greg Kroah-Hartman posted 40 patches 3 years, 2 months ago
[PATCH 4.14 05/40] efi/libstub: Disable Shadow Call Stack
Posted by Greg Kroah-Hartman 3 years, 2 months ago
From: Sami Tolvanen <samitolvanen@google.com>

[ Upstream commit cc49c71d2abe99c1c2c9bedf0693ad2d3ee4a067 ]

Shadow stacks are not available in the EFI stub, filter out SCS flags.

Suggested-by: James Morse <james.morse@arm.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
Stable-dep-of: 1a3887924a7e ("efi: libstub: Disable struct randomization")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/firmware/efi/libstub/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index 678bc910e080..54dbcec7e06f 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -23,6 +23,9 @@ KBUILD_CFLAGS			:= $(cflags-y) -DDISABLE_BRANCH_PROFILING \
 				   $(call cc-option,-ffreestanding) \
 				   $(call cc-option,-fno-stack-protector)
 
+# remove SCS flags from all objects in this directory
+KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS))
+
 GCOV_PROFILE			:= n
 KASAN_SANITIZE			:= n
 UBSAN_SANITIZE			:= n
-- 
2.35.1
Re: [PATCH 4.14 05/40] efi/libstub: Disable Shadow Call Stack
Posted by Pavel Machek 3 years, 2 months ago
Hi!

> From: Sami Tolvanen <samitolvanen@google.com>
> 
> [ Upstream commit cc49c71d2abe99c1c2c9bedf0693ad2d3ee4a067 ]
> 
> Shadow stacks are not available in the EFI stub, filter out SCS
> flags.

AFAICT, SCS is not available in 4.19, CC_FLAGS_SCS is not defined
there, and we should apply this patch.

Best regards,
								Pavel

> +++ b/drivers/firmware/efi/libstub/Makefile
> @@ -23,6 +23,9 @@ KBUILD_CFLAGS			:= $(cflags-y) -DDISABLE_BRANCH_PROFILING \
>  				   $(call cc-option,-ffreestanding) \
>  				   $(call cc-option,-fno-stack-protector)
>  
> +# remove SCS flags from all objects in this directory
> +KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS))
> +
>  GCOV_PROFILE			:= n
>  KASAN_SANITIZE			:= n
>  UBSAN_SANITIZE			:= n

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Re: [PATCH 4.14 05/40] efi/libstub: Disable Shadow Call Stack
Posted by Greg Kroah-Hartman 3 years, 2 months ago
On Mon, Sep 26, 2022 at 01:14:08PM +0200, Pavel Machek wrote:
> Hi!
> 
> > From: Sami Tolvanen <samitolvanen@google.com>
> > 
> > [ Upstream commit cc49c71d2abe99c1c2c9bedf0693ad2d3ee4a067 ]
> > 
> > Shadow stacks are not available in the EFI stub, filter out SCS
> > flags.
> 
> AFAICT, SCS is not available in 4.19, CC_FLAGS_SCS is not defined
> there, and we should apply this patch.

Now dropped from everywhere, thanks.

greg k-h