From patchwork Tue Apr 18 13:49:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13215739 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 348E8C77B75 for ; Tue, 18 Apr 2023 13:50:52 +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=i+a5e9Yim+lBup 8I0QYlFOdDs3GM33G96CXXq35jZLnGmGlqvlEZMFAxKCEHN/ZHkWSjXPSfw2JAvTcDnQEbR8SO5d0 mTi1uD1cUI8fv2/Aur2EGxYXWIhyHBP9ll4rzSQVFEmEFEUqUZGFemp9Mx/AXw543V6CuwMeIANRs He4AAGUmSZ+qdduGOyw5FtB5mLeL/Ece8YWlqCe4SOaJXlO4WwY6hLwrDzRQPI+uQh1JNQ/X2Z0E3 EEzZQORkcm8aFWQmGfIv6K5Mb9ePKM1KDYQbn2tKhNsXiymiN49mxi72aVRcZWLcL7lX+9NYxR5td HwC3a1KpAzpEBnSOavtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1polij-002K5T-1r; Tue, 18 Apr 2023 13:50:09 +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 1polih-002K4h-0W for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 13:50:08 +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 C142462828; Tue, 18 Apr 2023 13:50:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3689C433D2; Tue, 18 Apr 2023 13:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681825806; bh=NN1vX7GS8UcvvMTsQiKYpCnrGd1Eg9mW+O4yymmSSt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qd3ui+f8dEpD4/5QJfvORJNIux1XawcE0g94nedKnxMrii9QykTiOCZdb9jaXRVuo dqNY1blHi+Fxtl5Wttyq/EAlJr9LR4wrLkmnEbbZWohqp8AtJk7bqiQKlzpZdyYepZ nQHrFOcM922XMqGeBgSAhMHHQZfsoM9UebEJAF/XetBL65VdHL3pUCyhernIuvlsfD 8hhxVIxQItS+Y3SGtLDj1czzABdl/2Ca0SUako3JcSuYuKDKeqVUEEx7QSYDb06707 +q75JJBN5UV/+5j9Qm4XN9Loj9z7/qbZwkmgkdlO/k2tO5v64a6dtXVNgU17ZShP/u 4loZn1tOyLmAQ== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, broonie@kernel.org, will@kernel.org, catalin.marinas@arm.com, Ard Biesheuvel Subject: [PATCH v2 1/6] efi/pe: Import new BTI/IBT header flags from the spec Date: Tue, 18 Apr 2023 15:49:47 +0200 Message-Id: <20230418134952.1170141-2-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230418134952.1170141-1-ardb@kernel.org> References: <20230418134952.1170141-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=owGbwMvMwCFmkMcZplerG8N4Wi2JIcVu/s8k7iT33yaTPF47XttwKeGXtKGUAOfpZ/634k4EJ rTES5Z3lLIwiHEwyIopsgjM/vtu5+mJUrXOs2Rh5rAygQxh4OIUgImoPmb4w/FtuaTQ/mtu9Ycb 6+aXRiks+CuYuyzo2lTpJVPWaWuHlTL8FZxbM+Xdy4nV+xQ/rshJaa2+m5D4uojnuufO2WKht/O ucQIA 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-20230418_065007_240591_3A717582 X-CRM114-Status: GOOD ( 11.67 ) 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__