Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp243746pxu; Thu, 7 Jan 2021 03:56:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8NlY8UgVXh73Ao/qyu8L3CaJm2EGRWjS8FX3N5z0WJnISz/rNL0MooECbc0hCvAaC46NL X-Received: by 2002:a17:906:55d0:: with SMTP id z16mr5981701ejp.466.1610020563664; Thu, 07 Jan 2021 03:56:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610020563; cv=none; d=google.com; s=arc-20160816; b=YVZ6ZPYeA63NkrEGMkgmRwEAhrEkdnfdJoczKUJ15qhVJ7+8d4GZ7ilwFKp60ZHvuf vlwSD0Hng1o5r6PurEBSwJppYKWCCjbYS3WOwbjxpZEcDl5bqZ+xhwAeRets2e+SC3Jq E763fZprid1Isxnt9QXNV8eBYCq9wiVz0Hw5asA6kExg4G84ys2r8FZHIGuWLuKS6RPO dazF5UpL0Xy5Xj1iCbyGrkXu83G0LAu9zRdacMfMla0pOWBcHZ5ykHeyZW+NQwTXqWP6 2qMOAymQS27CXG2Pb79iuGU/w6sIBMLXjKkQUlwhGujpHtOPrk5NIMuj2LXsXhxOgZNb uMMA== 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 :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=Yi9X+eUEsj/PoAs0Ktl/IbvqOd3Iq8nO46nm6Q1y7o8=; b=vlxOsQqIgA+Eg8gtE3e8SG/B5ll8Sjrq/fNaGWeH3vCJRuGpPlbLdsdV5grPlNRar/ o4zLivwf/+RRO4l0QbgzKTpWGNxNx/+yc+yZ6Uiyb/Hq0SHHEMPaHQZDHQB0u/BTIKNp V1yeaC4hapEFnH71nl0BoIugQUKRQqoRZMSpnCW+rGoIwpLiNrMzWEvJ6pdUsV+9Ci31 Ut/cgAFdgD3h42kTGW/kv7za26xlGwX1EEGiSs7qZACYYIl9somvB+24hqYlLDPOo6ih PweeXiSBCOM+nTqx7LcIl5h2zbqD+66g+ONXvxlYi6Qo9KGUm+wV71I9YyNzZsUBW/SI VvEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=olch6uOd; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g20si2164878edm.288.2021.01.07.03.55.40; Thu, 07 Jan 2021 03:56:03 -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=@pm.me header.s=protonmail header.b=olch6uOd; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728008AbhAGLyq (ORCPT + 99 others); Thu, 7 Jan 2021 06:54:46 -0500 Received: from mail1.protonmail.ch ([185.70.40.18]:45734 "EHLO mail1.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726229AbhAGLyp (ORCPT ); Thu, 7 Jan 2021 06:54:45 -0500 Date: Thu, 07 Jan 2021 11:53:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1610020441; bh=Yi9X+eUEsj/PoAs0Ktl/IbvqOd3Iq8nO46nm6Q1y7o8=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=olch6uOdeXf81zieTiFd4h4w+2qI8kBFfpV4nb4jEmg59GwerED1uRcSnqoiEcKbA iXvjaXQT+e30EtH1gsdlB7UaDFzaD9NHI3qiMe+49kIbnrh2H9dJsGF/EhIfGAvPiB omBDZJ88L9owcLFIxIfOh87KHx4xxDMyGTjjapllxvzh2oDfjgy1hZd76e254FeH5y YLw61PJDRn1uAE+zqNPjGkBvk7Dmi/gQYNpw4cLdBml/l2ND8WEVrkagb5T4SCIJAN rYN7xCt3aNCOZhxqsi2b6MPUR2+V0nWPnLyDZJv8vEd9jrSH3SzvMkdBDf/iSE8WEn G+VPjAMK7R/IQ== To: Thomas Bogendoerfer From: Alexander Lobakin Cc: Arnd Bergmann , Kees Cook , Nathan Chancellor , Nick Desaulniers , Fangrui Song , Huacai Chen , Pei Huang , Jiaxun Yang , Alexander Lobakin , Sami Tolvanen , Ingo Molnar , Ralf Baechle , Corey Minyard , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, stable@vger.kernel.org, clang-built-linux@googlegroups.com Reply-To: Alexander Lobakin Subject: [PATCH v3 mips-next 3/7] MIPS: properly stop .eh_frame generation Message-ID: <20210107115329.281266-3-alobakin@pm.me> In-Reply-To: <20210107115329.281266-1-alobakin@pm.me> References: <20210107115120.281008-1-alobakin@pm.me> <20210107115329.281266-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 3682d1a0bb80..908f6d6ae24b 100644 --- a/arch/mips/include/asm/asm.h +++ b/arch/mips/include/asm/asm.h @@ -20,10 +20,27 @@ #include #include =20 +#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=09.cfi_sections .debug_frame +#else + /* + * For the vDSO, emit both runtime unwind information and debug + * symbols for the .dbg file. + */ +#define CFI_SECTIONS=09.cfi_sections .debug_frame, .eh_frame +#endif + /* * LEAF - declare leaf routine */ #define LEAF(symbol)=09=09=09=09=09\ +=09=09CFI_SECTIONS;=09=09=09=09\ =09=09.globl=09symbol;=09=09=09=09\ =09=09.align=092;=09=09=09=09\ =09=09.type=09symbol, @function;=09=09\ @@ -36,6 +53,7 @@ symbol:=09=09.frame=09sp, 0, ra;=09=09=09\ * NESTED - declare nested routine entry point */ #define NESTED(symbol, framesize, rpc)=09=09=09\ +=09=09CFI_SECTIONS;=09=09=09=09\ =09=09.globl=09symbol;=09=09=09=09\ =09=09.align=092;=09=09=09=09\ =09=09.type=09symbol, @function;=09=09\ diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.= S index 16468957cba2..0f4e46ea4458 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -225,6 +225,5 @@ SECTIONS =09=09*(.options) =09=09*(.pdr) =09=09*(.reginfo) -=09=09*(.eh_frame) =09} } --=20 2.30.0