From patchwork Tue Apr 4 15:19:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13200470 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 1BC0DC761A6 for ; Tue, 4 Apr 2023 15:21:05 +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:References:In-Reply-To: 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: List-Owner; bh=k75/nok/RL6xLuusBOZqw+Xr0zMmyTkwSaoVpOwZZ+I=; b=YCb7h8F4PzSyMb +hHRSmEnjy9ThkPqjog636FJjx1CZULcS33CJJLxwRRIP/mY/x+yLi+avtbT6cIAjfmKcVV2Qs/7J 9wo6OSEIcpe+3d7cG/lqlJ4dghXwkWMxXEHdOnMpDKc93cwWT7Ity6s75uafNqqyWgmARJmywZvxD yH2ZFtiHbH4qsrCB9wU38OmGseEi9tEtumyictpjZyNk1yWDYDWb68rsITir4RBb5g/JeJPFQCaI+ v1Eq7RlZLRk9a+Ep70LS5VrLFIKbMRRh5c7AR8AkvLlpwaPQSTcHu7o3f1PpnCcBeK/SbOSFZm2+j ZagZu+3Ldqv34BCZKQpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pjiSC-001xn4-0T; Tue, 04 Apr 2023 15:20:12 +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 1pjiS9-001xlq-2k for linux-arm-kernel@lists.infradead.org; Tue, 04 Apr 2023 15:20:11 +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 4B953635CE; Tue, 4 Apr 2023 15:20:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C191C433D2; Tue, 4 Apr 2023 15:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680621608; bh=NN1vX7GS8UcvvMTsQiKYpCnrGd1Eg9mW+O4yymmSSt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MeYDBCPmAPj9dc7jnexw4cX8cbFyMj1wHuEfW9YKhA3K+0McpPu32F5m5Athdpd2T aJ1ud/evrdfR1ByV9TbhOiqiQMwGrVpZ0YZ0wk3IoLpPXUcVANvBS6FTUIu69kbtN4 xlWqINE1R20TwzN229/yuxgf+4vA1aKNwKwuHI1oLNICv6BMLlm9Mj3Ey/bvf1xrQB 9XHJjxK476gK5nnvvKwSc+TlYWGUAAwr3SCEFzQb5yxgosOitXIvJTYTQkRqfUv9zy +3bVCeYOHJ2Z6WjRU2zHU5OZ2fqguMyrX8JaYBeHA1ArNhzof6P4FFiTA1IZKF8piG ULvC9hRMkeOfg== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, broonie@Kernel.org, Ard Biesheuvel Subject: [PATCH 1/6] efi/pe: Import new BTI/IBT header flags from the spec Date: Tue, 4 Apr 2023 17:19:54 +0200 Message-Id: <20230404151959.2774612-2-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230404151959.2774612-1-ardb@kernel.org> References: <20230404151959.2774612-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1294; i=ardb@kernel.org; h=from:subject; bh=NN1vX7GS8UcvvMTsQiKYpCnrGd1Eg9mW+O4yymmSSt8=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIUXHQSKJO8n9t8kkj9eO1zZcSvglbSglwHn6mf+tuBOBC S3xkuUdpSwMYhwMsmKKLAKz/77beXqiVK3zLFmYOaxMIEMYuDgFYCKifxkZtpenP3txLsn2T1Ko qf+d09MaDK7Jqrr5ZE2q/m4zs6r1McN/hw5zN7O2ue7F6aaXeY4H/Lv42Ow629qO02cTuSVf8J7 mAQA= 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-20230404_082009_933893_A65BD9CB X-CRM114-Status: GOOD ( 11.51 ) 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 latest version of your favorite fork of the PE/COFF spec includes a new type of header flag that is intended to be used in the context of EFI firmware to indicate to the image loader that the executable regions of an image can be mapped with BTI/IBT enforcement enabled. So let's import these definitions so we can use them in subsequent patches. Signed-off-by: Ard Biesheuvel --- include/linux/pe.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/pe.h b/include/linux/pe.h index 6ffabf1e6d039e67..5e1e115408702c77 100644 --- a/include/linux/pe.h +++ b/include/linux/pe.h @@ -118,6 +118,9 @@ #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 +#define IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT 0x0001 +#define IMAGE_DLLCHARACTERISTICS_EX_FORWARD_CFI_COMPAT 0x0040 + /* they actually defined 0x00000000 as well, but I think we'll skip that one. */ #define IMAGE_SCN_RESERVED_0 0x00000001 #define IMAGE_SCN_RESERVED_1 0x00000002 @@ -165,6 +168,7 @@ #define IMAGE_SCN_MEM_WRITE 0x80000000 /* writeable */ #define IMAGE_DEBUG_TYPE_CODEVIEW 2 +#define IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS 20 #ifndef __ASSEMBLY__