Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp429435pxb; Wed, 3 Mar 2021 06:53:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDm7lIGQmtkEsXW+fqKboMSEuUTJ6QpSxecdJ2KRz68WJQnl9zUFUW5wf2BHycVE+WZM4u X-Received: by 2002:a17:906:311a:: with SMTP id 26mr16445274ejx.395.1614783209936; Wed, 03 Mar 2021 06:53:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614783209; cv=none; d=google.com; s=arc-20160816; b=O53W4GNeCpZuzsDsPWDqGRcCin3Zv/rQ2gqHObuse0mC9HZHIUThIwi+Vp7plwNWI9 Wsn/CQsKDQc9tD+HNSh4Di/V0TiH5hNIPk5AfmoDa9DsvSddcmGJFfWm6As6hbkdZwTb GGBTO46kxL22c53XW1K9BchQ0ZhyO2reHK2l5GBYFwebhDw7P6gBaPH+CYceh985n3bm w6CA8uBE8lP9salD3n66FJYWPZ2RjQZrw1+wYNE562kaZwEg8P+aLJt5AdAIQU+TGnuR RcDjPzri/FpdKkUPwVxGiQCpqx9eq4+wVPrN2nW9OVw/nXyHDmpQNkq14HUC+DHaPtNd hbfQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M4Zrgzu8gtZ98T+Trx3PX+7a8TgsjOsdM7LXoHk1WYI=; b=Alp+wxVfspED3pI8zwL5YJes6I5zvwWAX/3R1XoR03iHGcUzNmpNcYznwDf29vcoaV aoLeMzR2p9Uhfe4OKQ9f/4rXgUDHxHSHFJCG3zXSf6E3qprvLPKrp4E84zvefhZPVAkp lXzm8IIRyPS2+vy9HVBolKodfCh6wjOzWfsdWJmd5t8MnlnfEzALKiCeIS7kYjCu/RCe /QrdeI2ouWwqX99KWx6tGYtlKQx8pgp0zQ/nmDbj0tJJXci3S/VpjoBoEL/bpx0OtpyT 322R5UwvmX9+M4rcoMxzGHVt+jtNjP8847uWYu/k/fVAZLrAeGG4Z01kGvUG/jiOlXbb N6Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jQP+3WnJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si6927173edp.540.2021.03.03.06.52.28; Wed, 03 Mar 2021 06:53:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jQP+3WnJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241321AbhCAWP4 (ORCPT + 99 others); Mon, 1 Mar 2021 17:15:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:54064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237897AbhCAR3f (ORCPT ); Mon, 1 Mar 2021 12:29:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBB1264F14; Mon, 1 Mar 2021 16:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617497; bh=aYJp4uy9jve8JhYzK60ocjFYjGNdD0C3/hetJ0wXVhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jQP+3WnJf11glfcsmPVF7WcXMcL7hV0zN1CJoyxrgG11atubw/sKlqrletXKc1Kvc sltCG0H3aP2ip8Md9CUHz1MF886sv1AMK9ezHzQVpMMBgCBlBX0iIYAIP5/NfzHVVj o355VcOkgzixeTpZLeGlVLUwAi6J6XA5qvtZd51Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Alexander Lobakin , Nathan Chancellor , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.4 093/340] MIPS: properly stop .eh_frame generation Date: Mon, 1 Mar 2021 17:10:37 +0100 Message-Id: <20210301161052.903116873@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161048.294656001@linuxfoundation.org> References: <20210301161048.294656001@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Lobakin [ Upstream commit 894ef530012fb5078466efdfb2c15d8b2f1565cd ] Commit 866b6a89c6d1 ("MIPS: Add DWARF unwinding to assembly") added -fno-asynchronous-unwind-tables to KBUILD_CFLAGS to prevent compiler from emitting .eh_frame symbols. However, as MIPS heavily uses CFI, that's not enough. Use the approach taken for x86 (as it also uses CFI) and explicitly put CFI symbols into the .debug_frame section (except for VDSO). This allows us to drop .eh_frame from DISCARDS as it's no longer being generated. Fixes: 866b6a89c6d1 ("MIPS: Add DWARF unwinding to assembly") Suggested-by: Kees Cook Signed-off-by: Alexander Lobakin Reviewed-by: Kees Cook Reviewed-by: Nathan Chancellor Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/include/asm/asm.h | 18 ++++++++++++++++++ arch/mips/kernel/vmlinux.lds.S | 1 - 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h index c23527ba65d09..64bffc1f75e0c 100644 --- a/arch/mips/include/asm/asm.h +++ b/arch/mips/include/asm/asm.h @@ -20,10 +20,27 @@ #include #include +#ifndef __VDSO__ +/* + * Emit CFI data in .debug_frame sections, not .eh_frame sections. + * We don't do DWARF unwinding at runtime, so only the offline DWARF + * information is useful to anyone. Note we should change this if we + * ever decide to enable DWARF unwinding at runtime. + */ +#define CFI_SECTIONS .cfi_sections .debug_frame +#else + /* + * For the vDSO, emit both runtime unwind information and debug + * symbols for the .dbg file. + */ +#define CFI_SECTIONS +#endif + /* * LEAF - declare leaf routine */ #define LEAF(symbol) \ + CFI_SECTIONS; \ .globl symbol; \ .align 2; \ .type symbol, @function; \ @@ -36,6 +53,7 @@ symbol: .frame sp, 0, ra; \ * NESTED - declare nested routine entry point */ #define NESTED(symbol, framesize, rpc) \ + CFI_SECTIONS; \ .globl symbol; \ .align 2; \ .type symbol, @function; \ diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index 09770a4d97846..faf98f209b3f4 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -226,6 +226,5 @@ SECTIONS *(.options) *(.pdr) *(.reginfo) - *(.eh_frame) } } -- 2.27.0