Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp955993rwb; Mon, 26 Sep 2022 07:55:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kHwNoYWkZAvEmOueJiW37jju5u8eNQvngusivKvjso2VC48sBT0nrvaXBbi+ba1mTkNp8 X-Received: by 2002:a17:90a:f3d3:b0:203:182b:9cd9 with SMTP id ha19-20020a17090af3d300b00203182b9cd9mr24857193pjb.41.1664204159457; Mon, 26 Sep 2022 07:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664204159; cv=none; d=google.com; s=arc-20160816; b=DJfhpZ3agBaKESXRdFbMOjmiLkMSC891uZlhH+uK1Xm9+KFuZYf545T4jU9OxNeShV GS1RpTf7OhK17LC79sWa5yZn0WTQuqfQd3HBHmKi6wdTuO9YfduzEa9DrP7Mj9Zv+tO9 +QjRLqBvXzzlzO9wI62aqeP1nmJZnrV1j9avkh4JZzWlgtuPHEaGNQBw2Gkwqk2VPfuQ hlRUoi8qhE+h6//p4zW4pDbxUts5Zt6qVc5wp/22pqIsQBlkMxM77x5GzMTABiZGc2es FLxTPKnTWj0eeMP222hgpq/M6D5TXFNsGka+kCdtz4rSCde1yex8XkObORRctEXBLQAH qJ5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=eYzbSIlJCtb/10QaF+cW6+fFW5+R7DbZFLBZ1zY0dyU=; b=rjsGsYWSjg2N7WDcxZHzDrv49j2w8TIMf+cME/7Jo+fLScxBaZVx/43kb6Rtt2NL8o /UJufzeT+up/gyY9gATIwGVkmVnM6Vgt+yBejuDyMlU6PhhNAGAzn7aXpjXDzmEx+7YT rcbmt3xEzYIdNVysrWlJRDaHB+rougNZqty53p+zNcEy1fmqc2wCoACKe+XOXqrVivKV RL18JfcnorSIbqYCWU5znhpoxNA5PPat36VAivoqOUwE1zLW18dlZhlIdWlYv/BWbsMf BGpQCJiRP3P7soep91agatRFd/JWwStamhSsgrixKofpu2aH6fZdt5J4h8kl1MmsAl6h 8Shw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g1-20020a056a0023c100b00543bc7e5bc9si19990464pfc.361.2022.09.26.07.55.25; Mon, 26 Sep 2022 07:55:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234983AbiIZNhx (ORCPT + 99 others); Mon, 26 Sep 2022 09:37:53 -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) X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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--