From patchwork Wed Apr 26 14:11:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13224633 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B474FC7618E for ; Wed, 26 Apr 2023 14:12:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=dXCr2KQmfAXOZn6tP8xmEKXTXvSu95mWSVH2Ap0c/vA=; b=DlPLt72W53gPAZ XGjz/VCaP6MuRfIjeKV5MM+s63TOUjQ8QQGGKwacPpp485yEWIZcHBs4cvvG1riyqRqCYqaaVnKwQ g7nanUq5lo3LqnbRtFys6JYm69cI/zAlLcbZvh1DlQ+pFMd+/3m1PAt/1vem5+ZPIA2s9/3uLueo6 iyQfFiiZBq1oI+1CTOrHzyrGgzxyL6etSh1TYtp0Ojk76ifhHH70BoPyGZic12x94YHWYEPqSNM/Z w6aIo3OpLh38A7cvD2cSvyVpTsn8DHbUBhBfEjLTGcsSP7iUo9RIASU4CHKOYQ33S+EjAY+W+goKS ATY04EHMEhGbwImvXWJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1prfrY-0049qf-2v; Wed, 26 Apr 2023 14:11:16 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1prfrW-0049q6-0E for linux-arm-kernel@lists.infradead.org; Wed, 26 Apr 2023 14:11:15 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A11786366E; Wed, 26 Apr 2023 14:11:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8949C433D2; Wed, 26 Apr 2023 14:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682518273; bh=kUHvDlh304QREoEAxxQud/4lPKTUAgBP83GHnxSAN9Y=; h=From:To:Cc:Subject:Date:From; b=E85o4l43m/zt8d6Dtw+goxCfOVoATvmnHQj6RAJT+R2Fa6WtdKU3XlaA9aZpm2qxj PYT1TiZT0t7f+m7/R7LVXteYtGMyAowNIWL0384RY8r9i1ZasjIFlrWSGXhKDwxdIK urJ5du+/bAVD5OsMSXIyZ4D3d5Mui/rWnHuukVQRKDi0XgGu8JS9sWPN037IZ8g5OV /t2voSunLhqoFZMzDo0hEEUB7ii8o9lvt+/wwwm3cz6mAb04VZO4z5lwgiR/D79kii yN71RdfgNeWSDZICAwup6blk2x+mwb1InH8jurKaQ1CD9tvREwQd5Y3iCVeaO8VaOK n1c9X2yXHVwTA== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: linux-efi@vger.kernel.org, mark.rutland@arm.com, catalin.marinas@arm.com, will@kernel.org, Ard Biesheuvel Subject: [PATCH 0/2] arm64: Expose kernel code size to EFI zboot code Date: Wed, 26 Apr 2023 16:11:01 +0200 Message-Id: <20230426141103.2464423-1-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1122; i=ardb@kernel.org; h=from:subject; bh=kUHvDlh304QREoEAxxQud/4lPKTUAgBP83GHnxSAN9Y=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIcXT4KvYzD2ZhQ9y7nf8lea/9UKRXcb3tXPdpv06Rzs2B j3U6CzrKGVhEONgkBVTZBGY/ffdztMTpWqdZ8nCzGFlAhnCwMUpABPpdWP47xEo+Nbmzdl9M6b9 mHaYzd7ISOV531qnSxufx8512ji7czbDPyUuUxW/IzWLLx1j3Z1x99jvnCKlf0rLX0meP5Z29Pa 8Kh4A X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230426_071114_164446_A6C24E45 X-CRM114-Status: GOOD ( 12.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The EFI zboot code needs access to the kernel code size, in order to be able to determine which part of the image needs to be cleaned to the PoU, and does not tolerate being mapped with non-executable permissions. Instead of adding [0] this to the kernel image header, which makes it ABI, let's use Kbuild rules to inject this quantity into the zboot payload ELF object. [0] https://lore.kernel.org/all/20230418134952.1170141-1-ardb@kernel.org/ Ard Biesheuvel (2): efi/zboot: arm64: Inject kernel code size symbol into the zboot payload efi/zboot: arm64: Grab kernel code size from zboot payload arch/arm64/boot/Makefile | 3 +++ arch/arm64/kernel/image-vars.h | 4 ++++ drivers/firmware/efi/libstub/Makefile.zboot | 16 ++++------------ drivers/firmware/efi/libstub/arm64.c | 19 +++++++++++++------ drivers/firmware/efi/libstub/efistub.h | 3 +-- drivers/firmware/efi/libstub/zboot.c | 15 ++++----------- drivers/firmware/efi/libstub/zboot.lds | 7 +++++++ 7 files changed, 36 insertions(+), 31 deletions(-)