Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3189560ybv; Mon, 24 Feb 2020 20:11:35 -0800 (PST) X-Google-Smtp-Source: APXvYqwRqQFC/nGb/POxvxa1v8R0V86eqbtIRubn/gHsQqsS+H5k+L5guATGDbPD881Jg7etfi9A X-Received: by 2002:a05:6808:346:: with SMTP id j6mr2029874oie.47.1582603894935; Mon, 24 Feb 2020 20:11:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582603894; cv=none; d=google.com; s=arc-20160816; b=Bspl8F1prKpLoYL6CuCksqsrzxlLxTJCamT7UmbjRjVKndqVZGsX7mihFKG+p/IYLw TCVdOe+tg8Rt1OgK1a/UPlb7rUxmzcPsjJDcRT6MBOmn/rgPTzuG6oCQiJ10jFxKE8xL 1mzN/9slVPj38JmQURJfPJHYsDI46GvXAOSSyDNhrjyZW/QkCls46yCnUYurIJH+E1kl HLungdD8JmBI6Fqs9tzqXOy8t8M5BypN6SK8ZZeR5EcUY6wmJoMzzrT3e3NlLrbN6iFx BlLTqyLDfUaWhw2YE17HL3dx9NpgjPEHPEib8rjcx+rgua/epnJO+u0lDj8di119ElPv 1crw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=MkHxxhEagzR8fO3G4O/HlLJK/mMYB1QzhvsGboCFrcg=; b=tc30K6TA0zyTIsIY+8pNYSz+a08GhCLIs07SsNKkKu8jTLnKQJoMQ2m6ehr4TgIhIS yvrWlnxpP1cGodQTu7UdU3x2wpibDdXFnYiqfVNwfuGplyrsg8I6cVVUX8mKVyiqEdQg F0j5lRQz5/ipECeXsgJ13o6aANO4sEFXqauIYseAOGbz3vFCgIRWS92xPN3eBWP2nxRW vLDiAZ7QzC4p0UGUMDncRXxvehdkiUzK2f9aBnhKyITKqRnF00IBw6LZjrOulsUZ1Xcj H8JmtqbXdmOiTYFGRUuoUNEJSpJqjTl34Uk9a3Z4ciaJpA4UHOXPi3e+qU3hn2HyBpnA hL5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=e2D5m+55; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si6416926otp.258.2020.02.24.20.11.22; Mon, 24 Feb 2020 20:11:34 -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=@chromium.org header.s=google header.b=e2D5m+55; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728926AbgBYELJ (ORCPT + 99 others); Mon, 24 Feb 2020 23:11:09 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:36309 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728776AbgBYELJ (ORCPT ); Mon, 24 Feb 2020 23:11:09 -0500 Received: by mail-pl1-f193.google.com with SMTP id a6so4943708plm.3 for ; Mon, 24 Feb 2020 20:11:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=MkHxxhEagzR8fO3G4O/HlLJK/mMYB1QzhvsGboCFrcg=; b=e2D5m+55MgOua8JNZA6u6S1cmF9YCb6lODSmx3tlqoYssIW9+bCN4Ryq3udVAtid9A 9ADASN2yhM030o/i+s67kTd2iMG/jQGNb8BzXTBVYikyROXOTNO3eS7EaZ3zAB9lCZUz 5NO4JyzpD6uWgMvZ5WxtzJ94l4oA5x04E73yU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=MkHxxhEagzR8fO3G4O/HlLJK/mMYB1QzhvsGboCFrcg=; b=LqCdEfCDVuoIvfczEPfC1xmSTvPq6DGYw74of48V0iiY7vzaNh1H+D/HMJG9KXyH+4 hC9KSevjcG4by+C+5sgMM80LpnERGYfXajtSjPiC9R7SkqVTmkx4yCSHNEqoFoQD+TXE zw6whJKv4Ptl9ubs6tVOgRE+4PFSs33sPDnNwltChmZa/gWMsrnPcB4zboJrgIWya8Xt jC43EXe2pqiN2KiGGMLZYovfv7OPUQdIx5d0eizIpOmA0puxHE5KyfBy4sJ3W//4uoNX jGC1altSu3MOmK1kB4awFgrEAjtbmLU8EqZ6TwdoPsxfopXLd9mVRFtSwb5EMXJgWC2Y m5tA== X-Gm-Message-State: APjAAAUapElhlBkkCDrUVkalhgQQNgJwHf8WZ0dSxF6n1qdkZVtNyAZH GVS4dU8B6TVYgWtQX/KgFJ/cvA== X-Received: by 2002:a17:90a:d585:: with SMTP id v5mr2837638pju.4.1582603868803; Mon, 24 Feb 2020 20:11:08 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w14sm14460628pgi.22.2020.02.24.20.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 20:11:08 -0800 (PST) Date: Mon, 24 Feb 2020 20:11:07 -0800 From: Kees Cook To: Arvind Sankar Cc: Nick Desaulniers , Borislav Petkov , Nathan Chancellor , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, LKML , clang-built-linux , Michael Matz , Fangrui Song , Andy Lutomirski Subject: Re: [PATCH v2 2/2] arch/x86: Drop unneeded linker script discard of .eh_frame Message-ID: <202002242011.541C9A57@keescook> References: <20200224232129.597160-3-nivedita@alum.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200224232129.597160-3-nivedita@alum.mit.edu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 24, 2020 at 06:21:29PM -0500, 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. > > Remove the one in the main kernel linker script as well, since there are > no .eh_frame sections already, and fix up a comment referencing .eh_frame. > > Update the comment in asm/dwarf2.h referring to .eh_frame so it continues > to make sense, as well as being more specific. > > Signed-off-by: Arvind Sankar Reviewed-by: Kees Cook -Kees > --- > arch/x86/boot/compressed/vmlinux.lds.S | 5 ----- > arch/x86/boot/setup.ld | 1 - > arch/x86/include/asm/dwarf2.h | 4 ++-- > arch/x86/kernel/vmlinux.lds.S | 7 ++----- > arch/x86/realmode/rm/realmode.lds.S | 1 - > 5 files changed, 4 insertions(+), 14 deletions(-) > > diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S > index 469dcf800a2c..508cfa6828c5 100644 > --- a/arch/x86/boot/compressed/vmlinux.lds.S > +++ b/arch/x86/boot/compressed/vmlinux.lds.S > @@ -73,9 +73,4 @@ SECTIONS > #endif > . = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */ > _end = .; > - > - /* Discard .eh_frame to save some space */ > - /DISCARD/ : { > - *(.eh_frame) > - } > } > 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/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h > index ae391f609840..f71a0cce9373 100644 > --- a/arch/x86/include/asm/dwarf2.h > +++ b/arch/x86/include/asm/dwarf2.h > @@ -42,8 +42,8 @@ > * Emit CFI data in .debug_frame sections, not .eh_frame sections. > * The latter we currently just discard since we don't do DWARF > * unwinding at runtime. So only the offline DWARF information is > - * useful to anyone. Note we should not use this directive if > - * vmlinux.lds.S gets changed so it doesn't discard .eh_frame. > + * useful to anyone. Note we should not use this directive if we > + * ever decide to enable DWARF unwinding at runtime. > */ > .cfi_sections .debug_frame > #else > diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S > index e3296aa028fe..5cab3a29adcb 100644 > --- a/arch/x86/kernel/vmlinux.lds.S > +++ b/arch/x86/kernel/vmlinux.lds.S > @@ -313,8 +313,8 @@ SECTIONS > > . = ALIGN(8); > /* > - * .exit.text is discard at runtime, not link time, to deal with > - * references from .altinstructions and .eh_frame > + * .exit.text is discarded at runtime, not link time, to deal with > + * references from .altinstructions > */ > .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { > EXIT_TEXT > @@ -412,9 +412,6 @@ SECTIONS > DWARF_DEBUG > > DISCARDS > - /DISCARD/ : { > - *(.eh_frame) > - } > } > > > 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 > -- Kees Cook