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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT 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 64C64C433E0 for ; Wed, 30 Dec 2020 22:22:10 +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 0EE9E207A3 for ; Wed, 30 Dec 2020 22:22:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0EE9E207A3 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.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:To:From:Subject:Mime-Version:Message-Id: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=qpbKsB3GytMR8SbZ+h73nw0iU4ZkjZ3hKSPQkoW03Ag=; b=gVdyA6g/Ky+8fYDPH/ibqo27XY XCZNzqFa2OIWThuXb0s5OX9L0aiit3w3LrSM5XpkV/ByM8sMwgGAC6VzBIGngc+vCjrR8L8xczRMN 47oekqjK5ZS6+SeDnyutJ/XLXmS3E0YYG/jVWXNip3LIfyblDrgN5v7PJQbVgo8vgk/gUMDG//NOS cjs1PPEPewRTok33O4A8Jz5+e+9MwmYQOzcGIuT36eGjJVYtRz8d8pjl1uIDAt4lEVgD6UgWYdb+Q j0+I7Lg1PTcbUrXJGOUSefWbtLob9/g1oeg0w68aWI9fIXh0u5uqJLRk1pnfRfLaL4niBq0IsrIXB oRpCKfwg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kujpB-0006TM-Gq; Wed, 30 Dec 2020 22:20:09 +0000 Received: from mail-qv1-xf49.google.com ([2607:f8b0:4864:20::f49]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kujp8-0006SY-6J for linux-arm-kernel@lists.infradead.org; Wed, 30 Dec 2020 22:20:06 +0000 Received: by mail-qv1-xf49.google.com with SMTP id x19so14536939qvv.16 for ; Wed, 30 Dec 2020 14:20:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=8Jm7qNzFhtfuWfdIEs4zQ4SZrqTKlbs8Q3oMA81BvZ0=; b=LtIR/g3HkjMntheUQsn0iYuMCOKJtuKEh2C7MF94Q9B4SdSGNVcrma7vsEA/KUIceX 7Sn8TZvkRs0oi61zOBsX6BVE2npKAuh3ICheDf/kLQd5dF+c9qspvrRYcG3f+nL2gaf/ Cjv5bBBd0SlOsiEcSZyhY+IF6h6w6qMcm/BuvkaaEPj8FVJxD5qfEWfSshpYO2+x8lGO RogrWuhbJMgpYA53GIx0May5BsUWap1BdL+vemJbzaMjYGYJEzDS2Zqakqriv7+A/Zvw llVzWzEDvHzcFkbwMb+CQaQg00j2DtNYva9aQfHmPVYhCMfYEGiRqpAS0Brs9cZ+mkXE pCtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=8Jm7qNzFhtfuWfdIEs4zQ4SZrqTKlbs8Q3oMA81BvZ0=; b=HsT9A7tjpgeNVzWoL+vkw6FzFf6sTyyMRI6zcbk/TIU7lxWhyyZ6VBH/8/MRjpvvHU FRCiSa5yhRcw9z6xECYKfnWGwTuMJo+QHqnkB34ywp9lgqFDlwhek9Gq/78szrNafeCB hnocpWMlVXEN0FPpVNxO8QvfadIPjOJ5LYUeT/7Hl1mzoiKndsAFlohI5xwNnxzmOHbo mHKMq1n/c8nWr8nndqXdecuVA581slzkh/EZMtV+ZzFvVBNOoRpapHSAi/j7vTHJmvxA Uvlh884do2Vu9cFa5J0WBQ2ygWsC74R31cMp2IK/bDv0TXWCZEIOwRLHQcV/ddEWORi4 imEQ== X-Gm-Message-State: AOAM532mUZeRicJBRpfYSmMkJ4aeudqpuknXLp+OK8CMvnJKQ/gw/KIS 3v3GZex0KCR3KTkGiqy+j08Ypz0= X-Google-Smtp-Source: ABdhPJzGsrqJbizn7OVuVTiORWXghmpD2gJJ/had3pMCcOAsLs63rUyZx6elqyd3jLgjPN48yX0fhrc= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:0:7220:84ff:fe09:385a]) (user=pcc job=sendgmr) by 2002:a0c:a366:: with SMTP id u93mr58907450qvu.53.1609366800971; Wed, 30 Dec 2020 14:20:00 -0800 (PST) Date: Wed, 30 Dec 2020 14:19:54 -0800 Message-Id: <20201230221954.2007257-1-pcc@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog Subject: [PATCH] arm64: vdso: disable .eh_frame_hdr via /DISCARD/ instead of --no-eh-frame-hdr From: Peter Collingbourne To: Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201230_172006_279360_0768C322 X-CRM114-Status: GOOD ( 14.93 ) 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 , Ard Biesheuvel , Tamas Zsoldos , Vincenzo Frascino , Peter Collingbourne , Dave Martin , 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 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. 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; } /* -- 2.29.2.729.g45daf8777d-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel