From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12722C07E9D for ; Mon, 26 Sep 2022 13:37:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234746AbiIZNhw (ORCPT ); Mon, 26 Sep 2022 09:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234687AbiIZNhX (ORCPT ); Mon, 26 Sep 2022 09:37:23 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ACC51E1CDF; Mon, 26 Sep 2022 04:57:27 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 7392E1C0016; Mon, 26 Sep 2022 13:08:25 +0200 (CEST) Date: Mon, 26 Sep 2022 13:08:26 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Daniel Marth , Ard Biesheuvel , Kees Cook , Sasha Levin Subject: Re: [PATCH 4.14 06/40] efi: libstub: Disable struct randomization Message-ID: <20220926110826.GE8978@amd> References: <20220926100738.148626940@linuxfoundation.org> <20220926100738.463310701@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="imjhCm/Pyz7Rq5F2" Content-Disposition: inline In-Reply-To: <20220926100738.463310701@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org --imjhCm/Pyz7Rq5F2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > These structs look like the ideal randomization candidates to the > randstruct plugin (as they only carry function pointers), but of course, > these protocols are contracts between the firmware that exposes them, > and the EFI applications (including our stubbed kernel) that invoke > them. This means that struct randomization for EFI protocols is not a > great idea, and given that the stub shares very little data with the > core kernel that is represented as a randomizable struct, we're better > off just disabling it completely here. > Cc: # v4.14+ AFAICT RANDSTRUCT_CFLAGS is not available in v4.19, so we should not take this patch. Best regards, Pavel > +++ b/drivers/firmware/efi/libstub/Makefile > @@ -23,6 +23,13 @@ KBUILD_CFLAGS :=3D $(cflags-y) -DDISABLE_BRANCH_PROF= ILING \ > $(call cc-option,-ffreestanding) \ > $(call cc-option,-fno-stack-protector) > =20 > +# > +# struct randomization only makes sense for Linux internal types, which = the EFI > +# stub code never touches, so let's turn off struct randomization for th= e stub > +# altogether > +# > +KBUILD_CFLAGS :=3D $(filter-out $(RANDSTRUCT_CFLAGS), $(KBUILD_CFLAGS)) > + > # remove SCS flags from all objects in this directory > KBUILD_CFLAGS :=3D $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS)) > =20 --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --imjhCm/Pyz7Rq5F2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmMxiCkACgkQMOfwapXb+vJtZQCffY9WfxvtGdq8edyOwHSeKdw2 sWAAn1ENXv4qLWWJwOhKZ3LmXqwksGkc =lLvp -----END PGP SIGNATURE----- --imjhCm/Pyz7Rq5F2--