Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2858627ybv; Mon, 24 Feb 2020 13:05:47 -0800 (PST) X-Google-Smtp-Source: APXvYqw/KW8a/CnW/RYDCFI5rZXyYRS2HM8mLlSkuZ3RML1RA2xXmb4RWac7xpi+g7NsEO8i7Uvc X-Received: by 2002:a9d:6748:: with SMTP id w8mr27270712otm.335.1582578347596; Mon, 24 Feb 2020 13:05:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582578347; cv=none; d=google.com; s=arc-20160816; b=ucb/TM4TfzimxWyzrGdGqVle7ZaQDgZCsdKjnSB6XWOKTXEZq0kajmowsHg2eAQvzO yT5jvj96Jgxt5AaDBzjKYI0xJmhVQ8gOsoSrKZo8r3rVe+KeHG0Re6zGnJQSvJAHT6te swD7GtWwGax2uPy1qZ3O1Wf8K+6OIP4HVdGcEiaL5K5ott38941p1kidYSKYUogMTIAF dx5fTVmifHerOAXIFg9MEJQle/QquYTVHL7U5OGkIBC2yHazj2pjSH8MTdGNyejZZSmC 8fBmuXg9vmP4xfEEXNUyE6xddbjmHx4nP6G0qw5qXHVmO+AJfwDm9zXsqBHNjm2Um3jB ZzPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=cSmpO0UrVcE+2EXGicwP6bV9bb5FnRrk6s8yuew8veA=; b=Cb3EayAM9CmGR5GRwlfqGSG269bhWWq4Z1TXVm4ueTyHfcE2gmNuPufzhoa6tIRvg7 2XqNMAfnXvM3BF2f8QBUaknIZa67KhUceqaOs0d1w0iRIG+6dll9DLV5zQgQxxJrxBbn OpPO89kfFcFGSuz/GsWH6Kk4ka9yLhve3W8zDvpqDtFjiTLp/LD6o3BUapmJMZ/s7oic J4ru8CH/iwflfzbNt20aHuv0wrtxOxAnAufpfI+3K+Nn0ueVJwkHVeFCy8VFyRMeEb+Y qpi2MreXAmFH14NRyLzsUUQoAVZB8Ptfql6Qckoy/T3GoZEcVFLLq2MqQ9Wi5g4/TViP A8mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=WrMS23gO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si5600301oie.56.2020.02.24.13.05.35; Mon, 24 Feb 2020 13:05: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=fail header.i=@gmail.com header.s=20161025 header.b=WrMS23gO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727741AbgBXVF0 (ORCPT + 99 others); Mon, 24 Feb 2020 16:05:26 -0500 Received: from mail-qv1-f65.google.com ([209.85.219.65]:44718 "EHLO mail-qv1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726996AbgBXVF0 (ORCPT ); Mon, 24 Feb 2020 16:05:26 -0500 Received: by mail-qv1-f65.google.com with SMTP id n8so4748846qvg.11 for ; Mon, 24 Feb 2020 13:05:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cSmpO0UrVcE+2EXGicwP6bV9bb5FnRrk6s8yuew8veA=; b=WrMS23gOBdcq4tHWEAeYjC97mxBP5x7c3tu2iiQPlG7Znem5mWDxJ3diVV6PnlGdUk Dbd+LcBBuy2AMoX4PbRHc0GbZellmQMlq/YLjrcg/wYL7aY3nyhnebbr8FZNcZ7rMd9v VoTbCYjY3SHRmCnDJIkdemladqulgCk/I2eZnDuc6MNbt5iM7CW4d/25GCOJES9cCXfv QARANAyaSXXnW/IdhSTPBOq037LlTSpvBbCzuA33aX8Nj1ROODS5dSXWFcS7Wy5N/TkC 8ZwNrkNoiissoz1vlkpLP1Ex7966jUQ+hpm3TWzQvWzmACNaSROP5D5+UlagR83lxR35 GloQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=cSmpO0UrVcE+2EXGicwP6bV9bb5FnRrk6s8yuew8veA=; b=rQ79a7+bYPlW074q6w+j5pdj3a+jOyXnAoMc9XI4r0JnphVCNixzSiApc2unLQaTLB RP9Kp+DHBK6CmQN9yGxN4HbhIqcRJOQ6KItsrFiAGyyN7aoX075zdKf/lFT6YzRw1ptx Npqge5nMaMAjWMzMa705Wl2iUmL4CS4gMwAsj77n1hgBlR9VeTYhQJXt8kYI98kBd/DM Hm2AveB131EH6D8GttHryE9HXBJAU1gI/0pw1P7oZsjOkbajS9GhAFoaEf19p1vFezh5 Q8UPDjAcLyUAi/JqlABSCRMXEcH1gpHtmHkFry7lmYlN7Pa9Toi2llVHYeljLNpCgtY+ C+UA== X-Gm-Message-State: APjAAAWNU5FMFCn27v86uFCDZrdxCHpJ6aYq0eWjGjRlZ7Hxb4UM3vF4 Ke1FM5/kInaQlL+TOcdvMzs= X-Received: by 2002:a0c:9d4f:: with SMTP id n15mr47503323qvf.194.1582578324649; Mon, 24 Feb 2020 13:05:24 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id a141sm6489195qkb.50.2020.02.24.13.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 13:05:24 -0800 (PST) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Mon, 24 Feb 2020 16:05:22 -0500 To: Nick Desaulniers Cc: Arvind Sankar , 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 Subject: Re: [PATCH 1/2] arch/x86: Use -fno-asynchronous-unwind-tables to suppress .eh_frame sections Message-ID: <20200224210522.GA409112@rani.riverdale.lan> References: <20200222235709.GA3786197@rani.riverdale.lan> <20200223193715.83729-2-nivedita@alum.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) 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 12:33:49PM -0800, Nick Desaulniers wrote: > On Sun, Feb 23, 2020 at 11:37 AM Arvind Sankar wrote: > > > > While discussing a patch to discard .eh_frame from the compressed > > vmlinux using the linker script, Fangrui Song pointed out [1] that these > > sections shouldn't exist in the first place because arch/x86/Makefile > > uses -fno-asynchronous-unwind-tables. > > Another benefit is that -fno-asynchronous-unwind-tables may help > reduce the size of .text! > https://stackoverflow.com/a/26302715/1027966 Hm I don't see any change in .text size. > > diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile > > index 98a81576213d..a1140c4ee478 100644 > > --- a/drivers/firmware/efi/libstub/Makefile > > +++ b/drivers/firmware/efi/libstub/Makefile > > @@ -12,7 +12,8 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \ > > -mno-mmx -mno-sse -fshort-wchar \ > > -Wno-pointer-sign \ > > $(call cc-disable-warning, address-of-packed-member) \ > > - $(call cc-disable-warning, gnu) > > + $(call cc-disable-warning, gnu) \ > > + -fno-asynchronous-unwind-tables > > I think we want to add this flag a little lower, line 27 has: > > KBUILD_CFLAGS := $(cflags-y) -DDISABLE_BRANCH_PROFILING \ > > so the `cflags-y` variable you modify in this hunk will only set > -fno-asynchronous-unwind-tables for CONFIG_X86, which I don't think is > intentional. Though when I run It is intentional -- the other case is that we're building for ARM, which only filters out the regular KBUILD_CFLAGS, so adding the flag for it should not be necessary. The cflags for ARM are constructed by manipulating KBUILD_CFLAGS. Besides it may or may not want unwind tables. 32-bit ARM appears to have an option to enable -funwind-tables. > > $ llvm-readelf -S drivers/firmware/efi/libstub/lib.a | grep eh_frame > > after doing an x86_64 defconfig, I don't get any hits. Do you observe > .eh_frame sections on any of these objects in this dir? (I'm fine > adding it to be safe, but I'm curious why I'm not seeing any > .eh_frame) > You mean before this patch, right? I see hits on every .o file in there (compiling with gcc 9.2.0). > > > > # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly > > # disable the stackleak plugin > > -- > > 2.24.1 > > > > > -- > Thanks, > ~Nick Desaulniers