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 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 F1C6CC433EF for ; Wed, 4 May 2022 19:00:51 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PEk0OP6BVzt18aTV4kEi+iIBM9AhDa5Kl2BB02vDCzo=; b=GrEm5/98vCYh4s bgWwsR8CGlq4jghQwKhFIvJ8ebXJAtgUlrTu/9oolahIMU57rlN82w6KExoVai7Jjy+fBD0ERmUJc HCePVzRnief7PJ8UFi0ackh1xzmAAvkuG9Z457OpkAFIekH5EZcQLcwopNbkWox06ihEL4efJZHZW kymITZ/aCqh2bA1LYBkziommo9w2kyZXmQhrkTqBXSGDtVC+H0si++ZZ+5CRksWbi0kKGjUz3r0eY pIz8aRILbT4FmSvwvahb9Fuy4e2nHuMMaPRtzzJ/4nQ2Eju93iinLl/aNbvVkPN9O+A3dWkj3w6qt 5FSajMiQiDhe7ixoAOBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmKDo-00CGix-Ba; Wed, 04 May 2022 18:59:36 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmKDj-00CGhX-VM for linux-arm-kernel@lists.infradead.org; Wed, 04 May 2022 18:59:33 +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 ams.source.kernel.org (Postfix) with ESMTPS id 038C2B8279F; Wed, 4 May 2022 18:59:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4BCAC385A5; Wed, 4 May 2022 18:59:27 +0000 (UTC) Date: Wed, 4 May 2022 19:59:24 +0100 From: Catalin Marinas To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, will@kernel.org, maz@kernel.org, mark.rutland@arm.com Subject: Re: [PATCH 1/2] arm64: lds: move special code sections out of kernel exec segment Message-ID: References: <20220429131347.3621090-1-ardb@kernel.org> <20220429131347.3621090-2-ardb@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220429131347.3621090-2-ardb@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220504_115932_355560_609958E6 X-CRM114-Status: GOOD ( 16.00 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Apr 29, 2022 at 03:13:46PM +0200, Ard Biesheuvel wrote: > There are a few code sections that are emitted into the kernel's > executable .text segment simply because they contain code, but are > actually never executed via this mapping, so they can happily live in a > region that gets mapped without executable permissions, reducing the > risk of being gadgetized. > > Note that the kexec and hibernate region contents are always copied into > a fresh page, and so there is no need to align them as long as the > overall size of each is below 4 KiB. > > Signed-off-by: Ard Biesheuvel This patch doesn't get very far. Under qemu, defconfig: EFI stub: Booting Linux Kernel... EFI stub: Generating empty DTB EFI stub: Exiting boot services... [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x000f0510] [ 0.000000] Linux version 5.18.0-rc3-00008-gfd536ceae063 (cmarinas@gaia) (aarch64-linux-gcc (GCC) 11.1.0, ...) [ 0.000000] earlycon: pl11 at MMIO 0x0000000009000000 (options '') [ 0.000000] printk: bootconsole [pl11] enabled [ 0.000000] efi: EFI v2.70 by EDK II [ 0.000000] efi: SMBIOS 3.0=0xbbed0000 MEMATTR=0xba919018 ACPI 2.0=0xb61a0018 RNG=0xbbfdbd18 MEMRESERVE=0xb6235f18 [ 0.000000] efi: seeding entropy pool [ 0.000000] Unable to handle kernel paging request at virtual address fffffbfffda351b4 [ 0.000000] Mem abort info: [ 0.000000] ESR = 0x96000007 [ 0.000000] EC = 0x25: DABT (current EL), IL = 32 bits [ 0.000000] SET = 0, FnV = 0 [ 0.000000] EA = 0, S1PTW = 0 [ 0.000000] FSC = 0x07: level 3 translation fault [ 0.000000] Data abort info: [ 0.000000] ISV = 0, ISS = 0x00000007 [ 0.000000] CM = 0, WnR = 0 [ 0.000000] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000bf11d000 [ 0.000000] [fffffbfffda351b4] pgd=00000000bf09c003, p4d=00000000bf09c003 [ 0.000000] Unable to handle kernel paging request at virtual address ffff00007f09cff8 [ 0.000000] Mem abort info: [ 0.000000] ESR = 0x96000004 [ 0.000000] EC = 0x25: DABT (current EL), IL = 32 bits [ 0.000000] SET = 0, FnV = 0 [ 0.000000] EA = 0, S1PTW = 0 [ 0.000000] FSC = 0x04: level 0 translation fault [ 0.000000] Data abort info: [ 0.000000] ISV = 0, ISS = 0x00000004 [ 0.000000] CM = 0, WnR = 0 [ 0.000000] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000bf11d000 [ 0.000000] [ffff00007f09cff8] pgd=0000000000000000, p4d=0000000000000000 [ 0.000000] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0-rc3-00008-gfd536ceae063 #4 [ 0.000000] pstate: 620000c5 (nZCv daIF -PAN -UAO +TCO -DIT -SSBS BTYPE=--) [ 0.000000] pc : die_kernel_fault+0x2dc/0x394 [ 0.000000] lr : die_kernel_fault+0x2ac/0x394 [ 0.000000] sp : ffffb594f7963ab0 [ 0.000000] x29: ffffb594f7963ab0 x28: ffffb594f7973340 x27: ffffb594f5a20000 [ 0.000000] x26: ffffb594f72c0000 x25: ffffb594f7214000 x24: ffffb594f7d1d000 [ 0.000000] x23: 0000000000000ff8 x22: ffffb594f7963bc0 x21: ffff00007f09c000 [ 0.000000] x20: 0000000096000007 x19: fffffbfffda351b4 x18: ffffffffffffffff [ 0.000000] x17: 6266666666662073 x16: 736572646461206c x15: ffffb594f7caeb38 [ 0.000000] x14: 0000000000000010 x13: ffffb594f79824a0 x12: 0000000000000036 [ 0.000000] x11: 0000000000000012 x10: ffffb594f79da650 x9 : ffffb594f79824a0 [ 0.000000] x8 : 00000000ffffefff x7 : ffffb594f79da4a0 x6 : 00000000000001b0 [ 0.000000] x5 : 000000000000bff4 x4 : 00000000fffff012 x3 : 0000000000000000 [ 0.000000] x2 : 0000000000000000 x1 : 0000000040000000 x0 : ffffb594f7083618 [ 0.000000] Call trace: [ 0.000000] die_kernel_fault+0x2dc/0x394 [ 0.000000] __do_kernel_fault+0xfc/0x180 [ 0.000000] do_translation_fault+0x58/0xc0 [ 0.000000] do_mem_abort+0x44/0x94 [ 0.000000] el1_abort+0x40/0x6c [ 0.000000] el1h_64_sync_handler+0xa4/0xd0 [ 0.000000] el1h_64_sync+0x64/0x68 [ 0.000000] paging_init+0x1e4/0x550 [ 0.000000] setup_arch+0x274/0x608 [ 0.000000] start_kernel+0x84/0x668 [ 0.000000] __primary_switched+0xc0/0xc8 [ 0.000000] Code: d0003580 91186000 cb0102b5 b2503eb5 (f8776ab8) [ 0.000000] ---[ end trace 0000000000000000 ]--- [ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task! [ 0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]--- _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel