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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CB29C433E0 for ; Tue, 5 Jan 2021 13:18:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 62DB522AAB for ; Tue, 5 Jan 2021 13:18:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62DB522AAB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3vTm1iQOdcdd3TZxDt+iSaCromgT8tISPnkdVJOlP5c=; b=AuoyB/w6QCkgofx0cZx/9r5E+ xQ1ChllpHVr+2AZR+Qg/YDI1ZRWOJAXR+HA9rJ6YPmiTAhugu4WftsrvIQTd0YEuxVA1+UO1ybbyR UJYjXSwvoWJWtU3Gr4KXDvFmUzX77trVhk48l+vnLIUiOpeTqQUyCAsXmKuuiu03vivnUwrcm44N7 xEDWeLHg4PvfMyHzP8BPkrfOo2xqaRdOT34Zpi7uvLldaew7hz8bCejzP/doT0Y8v3KQ1LY5rzgw8 JbScnbUeRBfGNukdfjLYORKy/W30edH6gxEk3Qo/7LhK0CtL6j7Nkigo5MxnXs4/Kf12SUMmB6W5f wB4qX9nLw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwmCs-0003oz-3Q; Tue, 05 Jan 2021 13:17:02 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kwmCp-0003nr-B3 for linux-arm-kernel@lists.infradead.org; Tue, 05 Jan 2021 13:17:00 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ECADF1063; Tue, 5 Jan 2021 05:16:47 -0800 (PST) Received: from [10.37.12.15] (unknown [10.37.12.15]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0D2413F719; Tue, 5 Jan 2021 05:16:45 -0800 (PST) Subject: Re: [PATCH] arm64: vdso: disable .eh_frame_hdr via /DISCARD/ instead of --no-eh-frame-hdr To: Peter Collingbourne , Will Deacon References: <20201230221954.2007257-1-pcc@google.com> From: Vincenzo Frascino Message-ID: Date: Tue, 5 Jan 2021 13:20:24 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201230221954.2007257-1-pcc@google.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210105_081659_587330_D63472CB X-CRM114-Status: GOOD ( 24.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Szabolcs Nagy , Catalin Marinas , Dave Martin , Tamas Zsoldos , Ard Biesheuvel , Linux ARM , Daniel Kiss 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 12/30/20 10:19 PM, Peter Collingbourne wrote: > Currently with ld.lld we emit an empty .eh_frame_hdr section (and a > corresponding program header) into the vDSO. With ld.bfd the section > is not emitted but the program header is, with p_vaddr set to 0. This > can lead to unwinders attempting to interpret the data at whichever > location the program header happens to point to as an unwind info > header. This happens to be mostly harmless as long as the byte at > that location (interpreted as a version number) has a value other > than 1, causing both libgcc and LLVM libunwind to ignore the section > (in libunwind's case, after printing an error message to stderr), > but it could lead to worse problems if the byte happened to be 1 or > the program header points to non-readable memory (e.g. if the empty > section was placed at a page boundary). > > Instead of disabling .eh_frame_hdr via --no-eh-frame-hdr (which > also has the downside of being unsupported by older versions of GNU > binutils), disable it by discarding the section, and stop emitting > the program header that points to it. > > I understand that we intend to emit valid unwind info for the vDSO > at some point. Once that happens this patch can be reverted. > Based on this: Acked-by: Vincenzo Frascino > Signed-off-by: Peter Collingbourne > Link: https://linux-review.googlesource.com/id/If745fd9cadcb31b4010acbf5693727fe111b0863 > --- > arch/arm64/kernel/vdso/Makefile | 3 +-- > arch/arm64/kernel/vdso/vdso.lds.S | 5 +---- > 2 files changed, 2 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile > index a8f8e409e2bf..cd9c3fa25902 100644 > --- a/arch/arm64/kernel/vdso/Makefile > +++ b/arch/arm64/kernel/vdso/Makefile > @@ -24,8 +24,7 @@ btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti > # routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so > # preparation in build-time C")). > ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv \ > - -Bsymbolic $(call ld-option, --no-eh-frame-hdr) --build-id=sha1 -n \ > - $(btildflags-y) -T > + -Bsymbolic --build-id=sha1 -n $(btildflags-y) -T > > ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18 > ccflags-y += -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO > diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S > index d808ad31e01f..61dbb4c838ef 100644 > --- a/arch/arm64/kernel/vdso/vdso.lds.S > +++ b/arch/arm64/kernel/vdso/vdso.lds.S > @@ -40,9 +40,6 @@ SECTIONS > PROVIDE (_etext = .); > PROVIDE (etext = .); > > - .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr > - .eh_frame : { KEEP (*(.eh_frame)) } :text > - > .dynamic : { *(.dynamic) } :text :dynamic > > .rodata : { *(.rodata*) } :text > @@ -54,6 +51,7 @@ SECTIONS > *(.note.GNU-stack) > *(.data .data.* .gnu.linkonce.d.* .sdata*) > *(.bss .sbss .dynbss .dynsbss) > + *(.eh_frame .eh_frame_hdr) > } > } > > @@ -66,7 +64,6 @@ PHDRS > text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */ > dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ > note PT_NOTE FLAGS(4); /* PF_R */ > - eh_frame_hdr PT_GNU_EH_FRAME; > } > > /* > -- Regards, Vincenzo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel