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 3F2AFC433FE for ; Tue, 29 Mar 2022 18:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240715AbiC2Ste (ORCPT ); Tue, 29 Mar 2022 14:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240706AbiC2Ste (ORCPT ); Tue, 29 Mar 2022 14:49:34 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D5DD41BFDE7 for ; Tue, 29 Mar 2022 11:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648579670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YU9NrQ7qR/EbmbaEdXYe2i+pIcnYUD7YyfctyhZp3Eo=; b=An3zv91IJkYZgfYAXO2LHvUmrLbTzx5SNmJ+P8dINKu7In4sbPyh/QGCw2StD/nEcnGP/M Y78TBa7uN3pZXe9FFmrbqQPcc5z4wGPvvOXHIxvGMl8BsCQxVLNmC+zuSy3Te8e5dWY/3v YM+psjebh93sXuUeYH9RMvcEHxRdFcc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-158-nJkZiW8DPoGfT3MX3uCxFg-1; Tue, 29 Mar 2022 14:47:45 -0400 X-MC-Unique: nJkZiW8DPoGfT3MX3uCxFg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2180985A5A8; Tue, 29 Mar 2022 18:47:45 +0000 (UTC) Received: from random.internal.datastacks.com (unknown [10.2.17.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id B29E32024CB7; Tue, 29 Mar 2022 18:47:44 +0000 (UTC) From: Peter Jones To: baskov@ispras.ru Cc: ardb@kernel.org, Matthew Garrett , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , linux-efi , Linux Kernel Mailing List , Peter Jones Subject: [PATCH] x86: Set the NX-compatibility flag in the PE header Date: Tue, 29 Mar 2022 14:47:43 -0400 Message-Id: <20220329184743.798513-1-pjones@redhat.com> In-Reply-To: <20220329184712.vl7jzq23h5m5kvqh@redhat.com> References: <20220329184712.vl7jzq23h5m5kvqh@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Following Baskov Evgeniy's "Handle UEFI NX-restricted page tables" patches, it's safe to set this compatibility flag to let loaders know they don't need to make special accommodations for kernel to load if pre-boot NX is enabled. Signed-off-by: Peter Jones --- arch/x86/boot/header.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 6dbd7e9f74c..0352e4589ef 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S @@ -163,7 +163,11 @@ extra_header_fields: .long 0x200 # SizeOfHeaders .long 0 # CheckSum .word IMAGE_SUBSYSTEM_EFI_APPLICATION # Subsystem (EFI application) +#ifdef CONFIG_DXE_MEM_ATTRIBUTES + .word IMAGE_DLL_CHARACTERISTICS_NX_COMPAT # DllCharacteristics +#else .word 0 # DllCharacteristics +#endif #ifdef CONFIG_X86_32 .long 0 # SizeOfStackReserve .long 0 # SizeOfStackCommit -- 2.35.1