Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2844432ybv; Mon, 24 Feb 2020 12:46:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxsN0bWjh4CKM+DRoQRazU51r2CZprTCxzs1oR+M2zvoYal29uM5PWRV4SLjYOV7klKkazx X-Received: by 2002:a05:6808:618:: with SMTP id y24mr722004oih.86.1582577207384; Mon, 24 Feb 2020 12:46:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582577207; cv=none; d=google.com; s=arc-20160816; b=wr46XYO2KtFp73pdQIXHhtLjZlv7UCRtHB5KttPjlfHiwDYu6UjZGK0udxSA9oW/A0 qyOsH/SI6NztBmhlozaVwvB/Ew3ZF3RAJRUyb+4isO/JVaepUplXkWh+mvJHX6vyR36Q VvIy+At2I6M40OAlKF4n32+8GkJa9L8emDPU+ffsBB+JLUmz38M6zVaFxhfJtj4Shzzx foG7x6ZLuNcrxRokChpxoQXb2poObV3+CiZz5GgVop5+06LquCWYYdaxUwSbzaHxOlQQ PPNhdl9O4UZAtMYWf+VbxvB7xKCD/RTZbON2U41GY4/mP5M8sM4/vSA1le43ceEaY8/L 2uoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=MEUjVJOmmnH8Vpry0d5ts1AnA+rtuK/pfVKzn69oCns=; b=kk0CTY/qL+IFAeqSBoK0WnXdDIq3a2FSa1ReH0L4oxuM2hWvaKKRiKEaq5L9QxV1wD l1I8GpRwiWk4Wo8rWT7d6hDg3j6U85y2oAo/XztM8+X+OyqtnUjgmR+rP1mP7puu9GVi l3g5X2JdHZhz0nGUfVoRJKoRxQ6lceR+bex7waz5d9XkXehUlRx4P4cTjQwet2UZ05Kd OdWY4F7vCDwGnXn5ZR1C3Bnv1UI6cROQ2eF0QfvvZmVg04Dsq6aZGtm3vLOsQosMf9sP XKr3aoamIN3rPEVIaGx4bT4x6t+PosuwKlPMj3bDSqzNYj65tSmXi9fFUsNvUV9Zzsjk paFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZRHSZE7c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si6678683oth.267.2020.02.24.12.46.34; Mon, 24 Feb 2020 12:46:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZRHSZE7c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727486AbgBXUqE (ORCPT + 99 others); Mon, 24 Feb 2020 15:46:04 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:43701 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727168AbgBXUqD (ORCPT ); Mon, 24 Feb 2020 15:46:03 -0500 Received: by mail-pf1-f195.google.com with SMTP id s1so5946104pfh.10 for ; Mon, 24 Feb 2020 12:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MEUjVJOmmnH8Vpry0d5ts1AnA+rtuK/pfVKzn69oCns=; b=ZRHSZE7cvsR8ZpuUv+0O/R6CEbotxvDzUTKr58Hu5rzAVvhc5byGevQLVKGfr3WYRS X7rvaAMMuyAAy11+scG8MQkejq/RMoDBKrT/gsnwHzc4uSHxtILLLZczYt7kQ4OvzxsV Z0S8qIe4VtwkrnPbdsFsKXclLTRiVLxYNgwlHkeS9YiaTk8xbH8o6VPHtX5q0b+HCWL8 4xcQpSkdnZwJNj1veGMZSfm4m91IDsNo0htOJ0kCV1y9Qr6c7rbIRiXBpDoPjOYwKTUz MUIvnH/WP6X3u6A2SuRGG1vyXqfECTLIi7+bQC959qaY7FpXvMEgH5M/iznKjfT23Rrs 3+2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MEUjVJOmmnH8Vpry0d5ts1AnA+rtuK/pfVKzn69oCns=; b=Ue4FvMeV0D7zlTrUI9UPXnZ+QZe2M6iJvdrGJ6cVdIIJBAqi+33oaf6Eb8s7frd895 j3GlMkP/dXcQfzkjUfMJa9C6bUa3cMTT4KSZfz+E8lyuxtHSCg7dFmeUZ66UYkVCOWZ+ W2DRwCBi6Oj2ElS4mnnJAWXoMFJsWF3pXTx2RvTdk2N8b4m3b0wNARDjy3D2hHaOy7A4 sJ/Fm1LwSfbh6FHcULrOUuleOUebBocUC7mvTF0HijVl1xQf06qItN6JwJ/3lXHRHndp LVr8r/Ewp59URrYnQHHQgLOs5skfwLm0RkPoZmpy91nl9mi1QPdVs9+17hJLRi8sgUcG hAkw== X-Gm-Message-State: APjAAAUGrWLJcxDHRn6RQsOnKQuZ0tfkfdt8z3eUE1CRCxYAX4j+MC2F nL/YSxY/w5ABC15lKHN8bJSojEwqAC4hVkfwihVv/Q== X-Received: by 2002:a62:37c7:: with SMTP id e190mr53707489pfa.165.1582577162505; Mon, 24 Feb 2020 12:46:02 -0800 (PST) MIME-Version: 1.0 References: <20200222235709.GA3786197@rani.riverdale.lan> <20200223193715.83729-3-nivedita@alum.mit.edu> In-Reply-To: <20200223193715.83729-3-nivedita@alum.mit.edu> From: Nick Desaulniers Date: Mon, 24 Feb 2020 12:45:51 -0800 Message-ID: Subject: Re: [PATCH 2/2] arch/x86: Drop unneeded linker script discard of .eh_frame To: Arvind Sankar Cc: Borislav Petkov , Nathan Chancellor , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , LKML , clang-built-linux , Michael Matz , Fangrui Song , Kees Cook , Andy Lutomirski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 23, 2020 at 11:37 AM Arvind Sankar wrote: > > Now that we don't generate .eh_frame sections for the files in setup.elf > and realmode.elf, the linker scripts don't need the /DISCARD/ any more. > > Also remove the one in the main kernel linker script, since there are no > .eh_frame sections already. Yep, we could go even further and validate the object files post link such that $(READELF) reported no .eh_frame section, suggesting the use of -fno-asynchronous-unwind-tables in KBUILD_CFLAGS. > > Signed-off-by: Arvind Sankar > --- > arch/x86/boot/setup.ld | 1 - > arch/x86/kernel/vmlinux.lds.S | 3 --- > arch/x86/realmode/rm/realmode.lds.S | 1 - > 3 files changed, 5 deletions(-) > > diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld > index 3da1c37c6dd5..24c95522f231 100644 > --- a/arch/x86/boot/setup.ld > +++ b/arch/x86/boot/setup.ld > @@ -52,7 +52,6 @@ SECTIONS > _end = .; > > /DISCARD/ : { > - *(.eh_frame) > *(.note*) > } > > diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S > index e3296aa028fe..54f7b9f46446 100644 > --- a/arch/x86/kernel/vmlinux.lds.S > +++ b/arch/x86/kernel/vmlinux.lds.S > @@ -412,9 +412,6 @@ SECTIONS > DWARF_DEBUG > > DISCARDS > - /DISCARD/ : { > - *(.eh_frame) > - } > } grepping for eh_frame in arch/x86/ there's a comment in arch/x86/include/asm/dwarf2.h: 40 #ifndef BUILD_VDSO 41 /* 42 * Emit CFI data in .debug_frame sections, not .eh_frame sections. 43 * The latter we currently just discard since we don't do DWARF 44 * unwinding at runtime. So only the offline DWARF information is 45 * useful to anyone. Note we should not use this directive if 46 * vmlinux.lds.S gets changed so it doesn't discard .eh_frame. 47 */ 48 .cfi_sections .debug_frame add via: commit 7b956f035a9ef ("x86/asm: Re-add parts of the manual CFI infrastructure") https://sourceware.org/binutils/docs/as/CFI-directives.html#g_t_002ecfi_005fsections-section_005flist is the manual's section on .cfi_sections directives, and states `The default if this directive is not used is .cfi_sections .eh_frame.`. So the comment is slightly stale since we're no longer explicitly discarding .eh_frame in arch/x86/kernel/vmlinux.lds.S, rather preventing the generation via -fno-asynchronous-unwind-tables in KBUILD_CFLAGS (across a few different Makefiles). Would you mind also updating the comment in arch/x86/include/asm/dwarf2.h in a V2? The rest of this patch LGTM. > > > diff --git a/arch/x86/realmode/rm/realmode.lds.S b/arch/x86/realmode/rm/realmode.lds.S > index 64d135d1ee63..63aa51875ba0 100644 > --- a/arch/x86/realmode/rm/realmode.lds.S > +++ b/arch/x86/realmode/rm/realmode.lds.S > @@ -71,7 +71,6 @@ SECTIONS > /DISCARD/ : { > *(.note*) > *(.debug*) > - *(.eh_frame*) > } > > #include "pasyms.h" > -- > 2.24.1 > -- Thanks, ~Nick Desaulniers