From patchwork Fri Nov 25 10:37:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Whitchurch X-Patchwork-Id: 13055751 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 A2086C4332F for ; Fri, 25 Nov 2022 10:51:28 +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:MIME-Version:Message-ID:Date:Subject:CC :To:From: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=CT/iMmIJaGLBVjDUXnw6ewkJ8qxoEMuKALdCAoURPqI=; b=W5dcQAICmHzoPN vCfpvbFKVeyuCNXWTQE3UyIT8OK+9NwAV6D7pwYmk+aRsUUH49jBgSI5g01JsH6VhUE8uQ0SCmNy/ QO6tRaSpfNNfdEezxJFCx3lbdTVIfM/XNm9+JnKV9yqZhdYoftLWW47U8zhE5Me6MfXFO+VAbBZ0Y ThZ/LtxKWk//CP6b0vYt9UFEi80mYR5Mce4oFycBvNTaqFD7LvNsvDa2mQStBtvEj1tS1WvW4Ch1o ExzN/4epxYmcifJ4ksA4AvhFmqVH3j0Z/ipoZdOOB333s3ZWemy3WcKDNh2k5AizO13vvUwSLc3Gu CfTfyO0COuIJGGzrwkNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyWHg-00FgmQ-U4; Fri, 25 Nov 2022 10:50:17 +0000 Received: from smtp1.axis.com ([195.60.68.17]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oyW5e-00FXXe-6U for linux-arm-kernel@lists.infradead.org; Fri, 25 Nov 2022 10:37:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1669372670; x=1700908670; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=D09VrSl7WEIOCmbG+vjrZPtMD0Rhl/PJ8YiALk/C7+o=; b=ZQ7bvQwGSdMtYyb9rUHgbLDnb7T+WiburyBGmKxeKabUmZ8eGEMYe28W SCHpK7E0tTTPO00ezPGRjsepq7i+RR426J6c170YagjJ2UO9mSSc8iZ0S 6Du94kcZ10Ka4v79vy26G9C8mpvmzHkSJi57cDo7/fJp/dOTRm2HlaHs3 0S++TdnncF2/y+02E0KbF4NpwcUpjEg9hQIHl4T29EHkGtgt77S3hr5WV yW3NNdJsFOjWHu59bqDhUk8YS6ooqGZSHAiSt+rZV4nrxXYN4zSIehSl1 c45jGl76ut7r2oJyksw0HKEdmE0gVxNDDNpxLezGuqwwljRW65uLWzJ0c A==; From: Vincent Whitchurch To: Catalin Marinas , Will Deacon CC: , Vincent Whitchurch , Tamas Zsoldos , Szabolcs Nagy , Daniel Kiss , Vincenzo Frascino , Ard Biesheuvel , , Subject: [PATCH] arm64: vdso: Include .eh_frame in debug ELF Date: Fri, 25 Nov 2022 11:37:40 +0100 Message-ID: <20221125103740.2062285-1-vincent.whitchurch@axis.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221125_023750_605807_9AFB3664 X-CRM114-Status: GOOD ( 13.79 ) 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 We currently strip out .eh_frame to work around crashes in libgcc when it tries to unwind out of signal handlers, see commit 87676cfca141 ("arm64: vdso: Disable dwarf unwinding through the sigreturn trampoline"). The .eh_frame does however have correct unwind information for the functions implemented in C in vgettimeofday.c, but currently this information is not available even for offline unwinding using the vdso.so.dbg. As a result of this, perf built with libdw is unable to unwind the stack when the PC is inside one of these functions. To fix this, strip the .eh_frame section only from the vdso.so and not from the vdso.so.dbg. This can be used by offline unwinders with access to the debug symbols, and will not affect libgcc since the section will still not be present in the normal vDSO. Cc: Tamas Zsoldos Cc: Szabolcs Nagy Cc: Daniel Kiss Cc: Vincenzo Frascino Cc: Ard Biesheuvel Signed-off-by: Vincent Whitchurch --- arch/arm64/kernel/vdso/Makefile | 2 +- arch/arm64/kernel/vdso/vdso.lds.S | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index 619e2dc7ee14..91aac17e11bc 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile @@ -65,7 +65,7 @@ $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE $(call if_changed,vdsold_and_vdso_check) # Strip rule for the .so file -$(obj)/%.so: OBJCOPYFLAGS := -S +$(obj)/%.so: OBJCOPYFLAGS := -S --remove-section=.eh_frame --remove-section=.eh_frame_hdr $(obj)/%.so: $(obj)/%.so.dbg FORCE $(call if_changed,objcopy) diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S index 6028f1fe2d1c..66abf70efc58 100644 --- a/arch/arm64/kernel/vdso/vdso.lds.S +++ b/arch/arm64/kernel/vdso/vdso.lds.S @@ -31,6 +31,8 @@ SECTIONS .gnu.version : { *(.gnu.version) } .gnu.version_d : { *(.gnu.version_d) } .gnu.version_r : { *(.gnu.version_r) } + .eh_frame : { *(.eh_frame) } + .eh_frame_hdr : { *(.eh_frame_hdr) } /* * Discard .note.gnu.property sections which are unused and have @@ -78,7 +80,6 @@ SECTIONS /DISCARD/ : { *(.data .data.* .gnu.linkonce.d.* .sdata*) *(.bss .sbss .dynbss .dynsbss) - *(.eh_frame .eh_frame_hdr) } }