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: 25923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3920811wrr; Fri, 25 Nov 2022 02:52:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf4JaPo0hDOy4qmiZtLW6s27WGOrnoBcR5BB5ibkR5J8j2vpf57O/cjjwJmElZdhzjTzPpxc X-Received: by 2002:a63:4944:0:b0:46f:ec9f:dcb0 with SMTP id y4-20020a634944000000b0046fec9fdcb0mr17950946pgk.202.1669373578770; Fri, 25 Nov 2022 02:52:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669373578; cv=none; d=google.com; s=arc-20160816; b=VI63k4zon9BiYxeoUhEBcoZCKmy2nX2zxPp0OJ+Px+cbwPoc2sQMqPsoSJlBjgzw+l sGkA0mz4KA17JSCNNexI1fpkGYVw/vwlnO8koM78ws4MsbJu0GX5Pom4AB0pl214H45k Z4Bib2wY0g1/TQhEq//d+tqyBfNW3TuyCsHzFUucWon7Pl3QFNP7LdgrMKXJ+9U/2B7+ 3PNtog9CYlmt+SdtIsj0KMb40Py510u9xvyb5FCt4+VLsJPIVy/mMq/JnxNvrjTOqgyt ZiT+1J08HY4skzrnC0N9+rGeXVAqD7losKctfaynHg6hWSvBOhUFT1pMLX5t3PLKlMJH nu6w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=D09VrSl7WEIOCmbG+vjrZPtMD0Rhl/PJ8YiALk/C7+o=; b=fvJj4oLcoSs0h3epAR8N4aJs3KtP5GvVpe0aN0xCRy2v8tI97KK25zHQNcymLC/vvs 6i40ttw0vHWqTTfsEsDsC/zXdFKWEHA0r5mhiQu8qRbEL0JFLY5Qk+fPLVuqP0LKmkOC SJsQBPlShLKUGCbDRk/pV4afgx/JV8Lp1tAiFDZKuhKj9jQBVoM/2tfMMA3iKgOJCC0c yWZpkIpJj/2WIHtsCaTem5gPn+6DhHRUWbBJf5Ym7zNlxi8t1NYWxm3EEelHSurSG8g1 +S0AkPGLTkXwRE2pM1M5nJSkUD57JXiDgR3JQqW+iETbVHUaJfppyH/A0Fvvcz1d3JQ/ pbiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b="SwGO/wxL"; 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=axis.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw14-20020a170903044e00b00188fc3a3fb1si3437797plb.184.2022.11.25.02.52.45; Fri, 25 Nov 2022 02:52:58 -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 (test mode) header.i=@axis.com header.s=axis-central1 header.b="SwGO/wxL"; 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=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229648AbiKYKhr (ORCPT + 99 others); Fri, 25 Nov 2022 05:37:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiKYKhq (ORCPT ); Fri, 25 Nov 2022 05:37:46 -0500 Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 342F311A26 for ; Fri, 25 Nov 2022 02:37:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1669372664; x=1700908664; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=D09VrSl7WEIOCmbG+vjrZPtMD0Rhl/PJ8YiALk/C7+o=; b=SwGO/wxLmsTVRghQQ322csv441MKRwlo0PB/axl6sKTQVVnIgCdrzJer QhlevagUNPI+VqPwOMDrwaW94C/g6G6TA4EPfQwmu+zxutWJCnik3cPYg Tj1W4j+Z3SsKnt4aAUet/KUXraDOBJM5QkoXFeXL5jZzL9pnjDHaPfHhy 17cK6epTmmFbtfb7Ayi9f2qnQ0+yKiklCgshhwSxUf/V47DCgRGQDOxbh pJ2D9DInfqIEln5GdRrTl4O0pSPOpSysN1tx3cFjcd1Enpu9YuoKmwYDd gtBlm+dXu6TaSxCCWbqzqsIWH6zUyp70S2Q90yr41IXizTp8ZPUFqTDOp w==; 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, 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?1750465070132638192?= X-GMAIL-MSGID: =?utf-8?q?1750465070132638192?= 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) } }