From patchwork Thu Dec 15 12:37:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeniy Baskov X-Patchwork-Id: 33618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp325922wrn; Thu, 15 Dec 2022 04:39:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf6xZRZUMYiAt/BUQif+hg0x/nooZgLeiTNpP+nJ77rExzvIX/J90h9x70BdhXwC9ciHOPGc X-Received: by 2002:a17:902:b08b:b0:188:6ab3:20c with SMTP id p11-20020a170902b08b00b001886ab3020cmr28473856plr.34.1671107969555; Thu, 15 Dec 2022 04:39:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671107969; cv=none; d=google.com; s=arc-20160816; b=X5UsDItaoPNDtgIL4pzj0IvRZ07ka1MXZKM+jgZJVcfhz+X5W4PlkFxgZdv1weusLw J1Y7Yok9qMS2U/YTF5oLvJ0v5eNyAlUUN7QL5676uhYG/EZ+hnpWDsZWJ3au/5FuHXvo C1cnDkDbTj/S+2N9blb/eBSdEV+Ak0py3lUxR+xVEvtzwJAlY0K7VpRo710gGdtypG+C NTE+UeCKNmmN0Yam8rsKuWmvPypAD+PZWCRdbu0nYsv6pK3+DJms++jt1+wXi7VwAEE8 iGWlMyKtH8ekzYffuuCsNnBjCoOYrp5tptiQMxwF8jTMlKtXRegMpdUlCQFRMfPp+Gdq 5hug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=HCT9Bqc8AfDy32Gy69bG6cmksbJB19vhwIjrpscg4oM=; b=D8FQ927/UMnxfWX+MBEZVhcUypxQ5vSKUkxrV7Vex0cPvzbUAikeAMYas98VLH0o9a gWUPMdNYKZKuBIKGviQJmsiiGGKe3vERcT9itgHWiQQgi2tgkAVNr7NpDozEZ96WFd69 AKQasVvNFgpXe6ZJWkyAfYan4+ZRMSvaxWzrjNgpehHBRH45rgjqauLAXYZnfa0nH23K 1pdCdgESirjzq2kWz76eAt5eOOMsu96aJ1VDRxt1tGsxYbi/tf3UFEcRSZUz/nagJGZR IFDoaZ0DvBQbvAs/cSEP3JuF8H1FGkPV4FeYvi78avQl1zfTCu9JSNtOeZ8ssitqpdBu 4eBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=Me3K4RFI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a170902dad200b001769e08c554si6717989plx.545.2022.12.15.04.39.16; Thu, 15 Dec 2022 04:39:29 -0800 (PST) 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; dkim=pass header.i=@ispras.ru header.s=default header.b=Me3K4RFI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229838AbiLOMjA (ORCPT + 99 others); Thu, 15 Dec 2022 07:39:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbiLOMii (ORCPT ); Thu, 15 Dec 2022 07:38:38 -0500 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85EB12EF61; Thu, 15 Dec 2022 04:38:25 -0800 (PST) Received: from localhost.localdomain (unknown [83.149.199.65]) by mail.ispras.ru (Postfix) with ESMTPSA id 7A286419E9FF; Thu, 15 Dec 2022 12:38:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 7A286419E9FF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1671107901; bh=HCT9Bqc8AfDy32Gy69bG6cmksbJB19vhwIjrpscg4oM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Me3K4RFI3zOA+GEY6O/L53J/ZrEO+4P8JYlfVVmXXeNKMCC2nO5F7oaz8/MYBxNGG lFKG/klJA8o6F/rS9L36xr7uqv2cEdd/7oSnSryOLpV3KICuw61yK8utNQkWMIWvc3 gzxB2OYv8tSToGikokKrEKkxcc70QOS05hjM9il8= From: Evgeniy Baskov To: Ard Biesheuvel Cc: Evgeniy Baskov , Borislav Petkov , Andy Lutomirski , Dave Hansen , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Alexey Khoroshilov , Peter Jones , "Limonciello, Mario" , joeyli , lvc-project@linuxtesting.org, x86@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v4 01/26] x86/boot: Align vmlinuz sections on page size Date: Thu, 15 Dec 2022 15:37:52 +0300 Message-Id: <8211c633eb5dceeabee2996a4db91cd971cf7c77.1671098103.git.baskov@ispras.ru> X-Mailer: git-send-email 2.37.4 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752283710289349947?= X-GMAIL-MSGID: =?utf-8?q?1752283710289349947?= To protect sections on page table level each section needs to be aligned on page size (4KB). Set sections alignment in linker script. Tested-by: Mario Limonciello Tested-by: Peter Jones Signed-off-by: Evgeniy Baskov --- arch/x86/boot/compressed/vmlinux.lds.S | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S index 112b2375d021..6be90f1a1198 100644 --- a/arch/x86/boot/compressed/vmlinux.lds.S +++ b/arch/x86/boot/compressed/vmlinux.lds.S @@ -27,21 +27,27 @@ SECTIONS HEAD_TEXT _ehead = . ; } + . = ALIGN(PAGE_SIZE); .rodata..compressed : { + _compressed = .; *(.rodata..compressed) + _ecompressed = .; } + . = ALIGN(PAGE_SIZE); .text : { _text = .; /* Text */ *(.text) *(.text.*) _etext = . ; } + . = ALIGN(PAGE_SIZE); .rodata : { _rodata = . ; *(.rodata) /* read-only data */ *(.rodata.*) _erodata = . ; } + . = ALIGN(PAGE_SIZE); .data : { _data = . ; *(.data)