From patchwork Fri Apr 28 18:09:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 13226668 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 A2BA6C77B61 for ; Fri, 28 Apr 2023 18:10:34 +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:Cc:To:From:Subject:Message-ID: Mime-Version:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=IU2sbic+MqBmo5Z2n3PMizmVzgPtrECsN5G2s6NNDmg=; b=oNa fxQkf87NTdcpC23iEora9Wopdt7K9ZZdGqOHEt9pDBR3zZfPDiKgSYGL/Hq39Rhbc5NDW75b7vtu0 oOYuLAKf9gbRwUNrRsmLyaXEFejchAiTyRWyPlhd7qt/ceP4yDeacJc5VldlfRqtIOmNhxCSp1Tju WNhhm1ZiSYMuuBA54xNJqkA4jqXZ7F9gLhBf8QN4zzfI9aauAQm7DjR8/6DA8q3YgfwbsXRjme2ab /xvQTq0WCKQFrXUBycoeD+PW6iyJlZxg6XVdYy30wHi6aCooJ+eiifaeV4OhKy7jcXOm5x1nzK0FJ h8//1rYidpInblXlZphuCQeS3qBTrfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1psSXM-00BR8m-0e; Fri, 28 Apr 2023 18:09:40 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1psSXJ-00BR6j-1e for linux-arm-kernel@lists.infradead.org; Fri, 28 Apr 2023 18:09:38 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-54c2999fdc7so2921857b3.2 for ; Fri, 28 Apr 2023 11:09:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682705372; x=1685297372; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=szMrRB+6uNQ8eyciuRiQr527CZbWdvgob9TY/kwfLGs=; b=jEnM8h2WmRSYHOV7JrVXCdH7EBqADBVIVINDIxCdBx1grlEFJxiRlEBBigmN2JQXfN 16i3etlXVKLhvp9qsaKWCaO0lYp4/FqCGDwplm5MZr/+LKSek+WK0Q4pgoiMkJme0RLm M6hsvWI4GyHkus7zmtDEGioT2PW8jBf8JqsNfNWxWYLQOLBUfOgVZslYNEodffOyBL1U B4XG88dh5csyvULX3rBHAbHa7yxNTnHfV3Dmh4cYo0V9L+K3Y+Bd7eFkt2P/0uSW/sij WAufZ06cW0+hbORLORjZx2i3XULQpPyas8KwYHLmKGlyrgU517TSRa/TViT6QEEOp/Yd Vzzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682705372; x=1685297372; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=szMrRB+6uNQ8eyciuRiQr527CZbWdvgob9TY/kwfLGs=; b=Ep4lRmKT+lLwP3+2Ew0HAwTIj9z0tw+fnct5BdLYtXMWl+Kr+IKk/Nk2B330JCe9LV 8W+R4NQoo+nVFaBWANIv3/Q5M+qr0ye28WjVg+A8aRycOR+7pYJhDYaGFclXNl2bPs78 T4Dd73xfbOzWk+gA128oKpYIu+ODRisAWPHHNsndj5fxgKOoMn9j9G2NRuH5gP5rz0Yo dfZMc6mSphp5mEs6CJBYm2lH1S+fGC2PfpR2pA57t1Wz0/c18PzKhFABjOctRwJgDxCl 5zRM2Z7BVvPzLVKZYy4mxnsJGl+a4+/DBM71pzmwkFJpr30q2cOC/rjbigIv5R3vO4rq 0Iiw== X-Gm-Message-State: AC+VfDxtNQOA3dW9/uT5sp3znfiDk+hlkGkFZQ9z17xPcoFWoqvwm++n bAIULXX70Ht4J18Gvwf1EPY+9yyajhFdxs8XUbs= X-Google-Smtp-Source: ACHHUZ4Dh0ZhHgHRrQTm+kfQrvOqSe4pbWS2GUqcJ1c3wpAvIoGqdFFanowzodwW/xY1NsQc1gIGkCeFZc77UL3yDP8= X-Received: from ndesaulniers-desktop.svl.corp.google.com ([2620:15c:2d1:203:7fbc:5712:e6b1:f733]) (user=ndesaulniers job=sendgmr) by 2002:a81:4011:0:b0:54f:9e1b:971c with SMTP id l17-20020a814011000000b0054f9e1b971cmr3698136ywn.1.1682705372224; Fri, 28 Apr 2023 11:09:32 -0700 (PDT) Date: Fri, 28 Apr 2023 11:09:25 -0700 Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIANQLTGQC/x2MSwqFMAwAryJZW9Ba8HMVcZHWqFlYJZH3BPHuV pfDDHOBkjApdNkFQj9W3mKCMs8gLBhnMjwmBlvYqnC2Mfg/TairyfmR6jY4SKVHJeMFY1jedkU 9SF6xC018fvt+uO8H78bmTG4AAAA= X-Developer-Key: i=ndesaulniers@google.com; a=ed25519; pk=UIrHvErwpgNbhCkRZAYSX0CFd/XFEwqX3D0xqtqjNug= X-Developer-Signature: v=1; a=ed25519-sha256; t=1682705370; l=2976; i=ndesaulniers@google.com; s=20220923; h=from:subject:message-id; bh=OJwVNKGwwd9jKotxFOlwqnw1rAfDxwhSr52KJhekYzI=; b=ZgrE30nmkV43i/VkWMTHmOw+6R/JwtaexxX9U/Hudmwq3K8EiFhFYVBa7BfIE+CZyxrU2+j1A7mc rMoBi3cCDZ/RN9YoMdrI3vrTq1PDmJbcG7hwOG83crnzRZOfiqCW X-Mailer: b4 0.12.2 Message-ID: <20230428-awx-v1-1-1f490286ba62@google.com> Subject: [PATCH] arm64: kernel: remove SHF_WRITE|SHF_EXECINSTR from .idmap.text From: ndesaulniers@google.com To: Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , Ard Biesheuvel , Fangrui Song , Greg Thelen , Nick Desaulniers X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230428_110937_547575_AB46FCDB X-CRM114-Status: GOOD ( 13.18 ) 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 commit d54170812ef1 ("arm64: fix .idmap.text assertion for large kernels") modified some of the section assembler directives that declare .idmap.text to be SHF_ALLOC instead of SHF_ALLOC|SHF_WRITE|SHF_EXECINSTR. This patch fixes up the remaining stragglers that were left behind. Because .idmap.text is merged into .text, LLD will retain the SHF_EXECINSTR on .text, in addition to the synthetic .got. This doesn't matter to the kernel loader, but syzkaller is having trouble symboling such sections. Clean this up while we additionally fix up syzkaller. Add Fixes tag so that this doesn't precede related change in stable. Fixes: d54170812ef1 ("arm64: fix .idmap.text assertion for large kernels") Reported-by: Greg Thelen Signed-off-by: Nick Desaulniers Reviewed-by: Ard Biesheuvel --- arch/arm64/kernel/cpu-reset.S | 2 +- arch/arm64/kernel/sleep.S | 2 +- arch/arm64/mm/proc.S | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) --- base-commit: 22b8cc3e78f5448b4c5df00303817a9137cd663f change-id: 20230428-awx-c73f4bde79c4 Best regards, diff --git a/arch/arm64/kernel/cpu-reset.S b/arch/arm64/kernel/cpu-reset.S index 6b752fe89745..c87445dde674 100644 --- a/arch/arm64/kernel/cpu-reset.S +++ b/arch/arm64/kernel/cpu-reset.S @@ -14,7 +14,7 @@ #include .text -.pushsection .idmap.text, "awx" +.pushsection .idmap.text, "a" /* * cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2) diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S index 2ae7cff1953a..2aa5129d8253 100644 --- a/arch/arm64/kernel/sleep.S +++ b/arch/arm64/kernel/sleep.S @@ -97,7 +97,7 @@ SYM_FUNC_START(__cpu_suspend_enter) ret SYM_FUNC_END(__cpu_suspend_enter) - .pushsection ".idmap.text", "awx" + .pushsection ".idmap.text", "a" SYM_CODE_START(cpu_resume) mov x0, xzr bl init_kernel_el diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 91410f488090..c2cb437821ca 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -167,7 +167,7 @@ alternative_else_nop_endif SYM_FUNC_END(cpu_do_resume) #endif - .pushsection ".idmap.text", "awx" + .pushsection ".idmap.text", "a" .macro __idmap_cpu_set_reserved_ttbr1, tmp1, tmp2 adrp \tmp1, reserved_pg_dir @@ -201,7 +201,7 @@ SYM_FUNC_END(idmap_cpu_replace_ttbr1) #define KPTI_NG_PTE_FLAGS (PTE_ATTRINDX(MT_NORMAL) | SWAPPER_PTE_FLAGS) - .pushsection ".idmap.text", "awx" + .pushsection ".idmap.text", "a" .macro kpti_mk_tbl_ng, type, num_entries add end_\type\()p, cur_\type\()p, #\num_entries * 8 @@ -400,7 +400,7 @@ SYM_FUNC_END(idmap_kpti_install_ng_mappings) * Output: * Return in x0 the value of the SCTLR_EL1 register. */ - .pushsection ".idmap.text", "awx" + .pushsection ".idmap.text", "a" SYM_FUNC_START(__cpu_setup) tlbi vmalle1 // Invalidate local TLB dsb nsh