From patchwork Tue Nov 22 11:12:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeniy Baskov X-Patchwork-Id: 24277 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2138716wrr; Tue, 22 Nov 2022 03:17:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf5dpMef+iRHx1zEPHRKl3YtErfoSH2myeWmAz5bOgU8ABbybt85xEFKkRbGAaL7yzgk9PaV X-Received: by 2002:a17:906:707:b0:7a2:fa90:924 with SMTP id y7-20020a170906070700b007a2fa900924mr8949266ejb.674.1669115862549; Tue, 22 Nov 2022 03:17:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669115862; cv=none; d=google.com; s=arc-20160816; b=UL0GWfSdzKHi8eSnx7uMj2qragflwGYcYMwr+Fs9ri/fd8sFRkDOvmoam4428igEPt ZohSkheksQ6TCyzPlJx7k30KMIWQke6ONrO2/SUm+HOpZ3piC6wX4qZavj8k6B2mrLtM 2/Iym7eHjk6ALx4ACFRJf/q7Iual/R894TcPv3PQKqlA9SKtGDTD1/u5DIFKVmbyeK6j tgzfpGdpGXkyfA1ESSB4OYDufC1I3MrsRXXJBQ3a4DDM2Jvo9kpJnbRW+8EY9g6DkJZA MfdY/XRv5xWFbtQjdNnes4DBV28SIVqtxP+N7Lk0yTMfEh0xuvGaYaIJih9+XRfOrGoK FmDA== 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=4ZeCfeL+Tv55vKbW3Vc1Ph6Cjl3WL9hmJicrinwykXM=; b=K7SYKxBdS4elTf8ciwZq6NGgTvrcaGEmaflU1lsR5fgUDGIJZrby98HgHLBsBu+Od3 EQ3mIB7ZNHaGekH3fhnRAN3Oeo/pE6D6y/ft0Za6z6G7VceeOzDNf2Ll8RLNO0E9U5Dr bbyO6UtyudBEWG/4psyPxYJ3pgd4f1yfW5lNYrRU/as/gL+yFZe5u626U3RbwwzlOLx+ fq6h3Mp84TKHpFAcaLJTG9fURwEslnrjWChn1zpCEL3gQWDJoqjegBnQckB1H9UpCYrd rfMQZyMokCWg3p2hQxrDHlTBELkTyb+AQwCUsARYcRJgkX5I9fbVfaxZ7ow9AVJEXOHk 8ugA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=LJ+J+4AH; 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 c20-20020a05640227d400b004542e6bd242si2307720ede.621.2022.11.22.03.17.18; Tue, 22 Nov 2022 03:17:42 -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=LJ+J+4AH; 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 S233146AbiKVLNL (ORCPT + 99 others); Tue, 22 Nov 2022 06:13:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232999AbiKVLMr (ORCPT ); Tue, 22 Nov 2022 06:12:47 -0500 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 866C81030; Tue, 22 Nov 2022 03:12:44 -0800 (PST) Received: from localhost.localdomain (unknown [83.149.199.65]) by mail.ispras.ru (Postfix) with ESMTPSA id 4CF12419E9F0; Tue, 22 Nov 2022 11:12:40 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 4CF12419E9F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1669115560; bh=4ZeCfeL+Tv55vKbW3Vc1Ph6Cjl3WL9hmJicrinwykXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJ+J+4AHnuC2D2QMr1jHJSyjPXrNYVvD5P4BnmbIvK/cWY1vZJBkzMMOQB8GL/p17 UpFi694ht927LmhYZA4meBb6AfGoTq9HdUGyglSFGnIxUCN2x+YtLmOyFi5Hcla056 qEQVE5BwUH9rZ7DQwz54vwlIGTIId+iTIGi2Y1QA= 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 v3 01/24] x86/boot: Align vmlinuz sections on page size Date: Tue, 22 Nov 2022 14:12:10 +0300 Message-Id: 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?1750194834985127155?= X-GMAIL-MSGID: =?utf-8?q?1750194834985127155?= 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 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)