Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp813303ybv; Sat, 22 Feb 2020 15:57:57 -0800 (PST) X-Google-Smtp-Source: APXvYqy5aHoGlRyK+FD1VJoGQkkP/jjuiv0Q+3qF02KEgCr9HOeQ4vtM4C3cKnCsYNTmrR4KTxO6 X-Received: by 2002:a05:6830:4c7:: with SMTP id s7mr34114428otd.359.1582415877748; Sat, 22 Feb 2020 15:57:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582415877; cv=none; d=google.com; s=arc-20160816; b=SXL1w61/iT/o7xKBg2vDICvTzuynY7BfucKBV+5bhjRlGSM2G6B7Xwj+Tn59aCq06T N1nWbvlSOKK2udlawWTsu/OLfSD5HJh6+GySfAzBLxAN0f5aIepwFYTdblKfKGpUSPPT YmGvDITxJuaKeiSNn3tYOBrE/cVPqel9lMsEQO6CfgxlQ/SGnisUkGptdLryizX3Tlcc IQYTwHIi5PcwBhfQbqEUFI6d80Bo2H3Ks53ZJYjoCTwlxjWja9v6fALpKxNRCRN4XMeV wWuZ+lAUyyuwZMmpVcIM5O0nleJNpJ78ADLsdrul+DYCR+pzkEjqGYlrBk0lBrC+DD9q MS3Q== 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=x3kNv1Qo240QfKiRXPHrXVP2xwNuaSo/ZPmgca9G6zk=; b=U26IDA0IlD1z8Fj5oVy8klN/x49W1oZ6HmE0AIhh8TLhB7a75e6M3VUoUVceTfF0Fb IHpWh5OoBqzzp1fTvTGLRf9lpAvuBV37m92uATQqkYpG78BaYocFZmvlG8iBUzTrVYzD nmpgM3vgVSDaLETOBPED4vXPr0RlMT9HTxzTVclSVZUcABlcuSG0KqpqTHSQf9paSDTn Epz7Pwrm33frmP6frPuhE2V67C22dPqAat7WY/FCtk2+Rsdr8BZWoGTe8Fr/EJJVta67 RdIBcbMy6GTyL257ue8XdVIVCKwdYKh7wpQP8LdFjP4o6fuaF2UjNsoND0tfEPeUZJK1 z3Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uI78GAmG; 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 k205si3030926oib.64.2020.02.22.15.57.44; Sat, 22 Feb 2020 15:57:57 -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=uI78GAmG; 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 S1727091AbgBVX5O (ORCPT + 99 others); Sat, 22 Feb 2020 18:57:14 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:39294 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726865AbgBVX5N (ORCPT ); Sat, 22 Feb 2020 18:57:13 -0500 Received: by mail-qk1-f195.google.com with SMTP id e16so2744664qkl.6 for ; Sat, 22 Feb 2020 15:57:13 -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=x3kNv1Qo240QfKiRXPHrXVP2xwNuaSo/ZPmgca9G6zk=; b=uI78GAmGOCdbULOlC+/g+i08hNp2OlgSgaGnHvs01r4HehJ0GPr61JHC/dvRK6UZbE odgsNZCScJbd/v6Xzrn+5l2/FjC7M0Sd+DzD4oKsCZRh80NJvNLbrwkoPNPLvc2rxR1Y O/GninOVEFOfwC9qOIR3ytdnsmuhwt4PL89Zp2TebcvPbIUvJk14wvbyEcs6joJ8OmUL CeVchfd/mkvoTacyDyMXnWXVhx9Ci08RNr3+7XBaWwJ03iOMunv5jhxQ8lPUKcQKpUIf Psj/UWz/KEk3MvevIZ5FxLcssPe2oOJofulQkwNXZZi9lp2Q4ZNtZAmKZ7TVeWoUfc0g MqDQ== 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=x3kNv1Qo240QfKiRXPHrXVP2xwNuaSo/ZPmgca9G6zk=; b=RxUB+pYj8zcnDSBJZ/dBlUHtHi8A2xB3E0SRPMip8k0AIwi+fqpBH9wkG5Y/KIX17/ 3zGcy4JvVG7GLRDW0BsITQoviTtDWgDwTOCaERwLBpJGvG0yHKZYleIQg3sYxUzu/mrQ KpOOHc71CIRxWd1ej12t+PPGr8NSLn5PW7MNuP2zexKvRI0m/MnAAVFWLSLkUTw1FhTg QaSBmGzXDhklh997W7BWAcUW8pLgUDp7lEQntuHiTupy6GPwAJJltZr7jOasl/vNRnZY wI8xpt2nBLWG9egNrK0pHOVFS+vsBAM5HeKOKpGMARgu5XoWdLAEmSZfXITAo3MDtqhw G9Yg== X-Gm-Message-State: APjAAAU+K5yQo5VN1gJS0mOCVmT1ODbgwVletugl4TWOkVb8+dPGSlYX inmjywLIUPLK4e3W0z92e5I= X-Received: by 2002:a37:4a46:: with SMTP id x67mr36506139qka.160.1582415832601; Sat, 22 Feb 2020 15:57:12 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id o7sm3800660qkd.119.2020.02.22.15.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Feb 2020 15:57:12 -0800 (PST) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Sat, 22 Feb 2020 18:57:10 -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] x86/boot/compressed: Fix compressed kernel linking with lld Message-ID: <20200222235709.GA3786197@rani.riverdale.lan> References: <20200222164419.GB3326744@rani.riverdale.lan> <20200222171859.3594058-1-nivedita@alum.mit.edu> <20200222181413.GA22627@ubuntu-m2-xlarge-x86> <20200222185806.ywnqhfqmy67akfsa@google.com> <20200222201715.GA3674682@rani.riverdale.lan> <20200222210101.diqw4zt6lz42ekgx@google.com> 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 Sat, Feb 22, 2020 at 03:33:20PM -0800, Nick Desaulniers wrote: > > Ah, yikes. For reference, please see my commit: > > commit b059f801a937 ("x86/purgatory: Use CFLAGS_REMOVE rather than > reset KBUILD_CFLAGS") > > I'm of the conviction that reassigning KBUILD_CFLAGS via `:=`, as > opposed to strictly filtering flags out of it or appending to it, is > an antipattern. We very very carefully construct KBUILD_CFLAGS in top > level and arch/ Makefiles, and it's very easy to miss a flag or to > when you "reset" KBUILD_CFLAGS. > > *Boom* Case in point. > > I meant to audit the rest of the places we do this in the kernel, but > haven't had the time to revisit arch/x86/boot/compressed/Makefile. > > For now, I suggest: > 1. revert `Commit TBD ("x86/boot/compressed: Remove unnecessary > sections from bzImage")` as it runs afoul differences in `*` for > `DISCARD` sections between linkers, as the intent was to remove > .eh_frame, of which it's less work to not generate them in the first > place via compiler flag, rather than generate then discard via linker. > 2. simply add `KBUILD_CFLAGS += -fno-asynchronous-unwind-tables` to > arch/x86/boot/compressed/Makefile with Fangrui's Sugguested-by tag. > 3. Remind me to revisit my proposed cleanup of > arch/x86/boot/compressed/Makefile (which eventually will undo #2). ;) > 4. tglx to remind me that my compiler is broken and that I should fix it. :P Ok. For reference, note that arch/x86/boot/Makefile also redefines KBUILD_CFLAGS and missed this option, which is why commit 163159aad74d ("x86/boot: Discard .eh_frame sections") was necessary. There's also arch/x86/realmode/rm/Makefile as well. There's also a bunch of places where the CFLAGS_REMOVE have fallen behind the times -- they remove only -pg rather than CC_FLAGS_FTRACE. Probably harmless currently since the other flags should be ineffective without the -pg but might want to clean this up as well.