Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3965696ybv; Tue, 25 Feb 2020 10:31:55 -0800 (PST) X-Google-Smtp-Source: APXvYqylx3b/ft1q7R7C34Hgm8LC7XnjkcNmtCpW0is9QL3y70gZjh8k9S/oPhN72fvo31MCi4+H X-Received: by 2002:aca:eccd:: with SMTP id k196mr196037oih.95.1582655515086; Tue, 25 Feb 2020 10:31:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582655515; cv=none; d=google.com; s=arc-20160816; b=wpsEUKukkTlak8nCFz/Wo54j3b2jY7pzPwVfIQ5id6Mv0W7oD9QXReAsRehATfxnmg 9Q/GOBJdk/PMw1A7Bsm96R8cQYf0dDcuXWs7OjxTDcy7/jPTpcn3VQWIyaaSEldDgNg/ cuVxr8zhRascfJaq9+wEP660D6HXg+pX++NWIxcwnsEiVAmTpaa0PjbP0po6lNvfFqiM f1lPFFpFEaMZeT5FGQBYcFBS8Q6GkOYOgDlI3em+OijxyKb4iwoY+32LcVYVHhelwKwr IZ4Ql7tgnTpQKv8t4HHxlrx5fSOxrS83Go/AObvd4ze6k9ZMkZo4WMoKG78MuekkguG6 XKfA== 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=dcyqLzOqexgUYT665cSkM8WWwCRhPRScopxtXSuIwhE=; b=nMqaVQZ8SGED+d2IcZSUjISOY1o+jmblRnAMOyVdHzZQ6XyQLnr6zzOGsNXO0PBPOo qBSbeYw1x5gNaOQ+fVbfTMQ3hw39RZvVw5KRDVjgdbxsBKg/va7wylHWDM/942VUKqBH AmhmGuncPj8RNhp3Z580ci+ehh2irVLaGrHk223oBdxP+7tqypMO07//IWhck25MCP8/ M37ani0WMidmqO8T7D8OUFZAdcLMuNBaCYwgGMS+1r3Ni1ySGgdcOwEfdPp14+muFUiX C1VB4GiLvvkkbS2BoCQU/gUGZ/PYJpK7q5u4DeKMvbQqxkbAbHwC+CXJGKeuNpJ+8hXs O+9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Jpmh+RNF; 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 v7si6887381oic.208.2020.02.25.10.31.42; Tue, 25 Feb 2020 10:31:55 -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=Jpmh+RNF; 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 S1731571AbgBYS3z (ORCPT + 99 others); Tue, 25 Feb 2020 13:29:55 -0500 Received: from mail-qt1-f180.google.com ([209.85.160.180]:34630 "EHLO mail-qt1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726699AbgBYS3z (ORCPT ); Tue, 25 Feb 2020 13:29:55 -0500 Received: by mail-qt1-f180.google.com with SMTP id l16so367230qtq.1 for ; Tue, 25 Feb 2020 10:29:54 -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=dcyqLzOqexgUYT665cSkM8WWwCRhPRScopxtXSuIwhE=; b=Jpmh+RNFwunTVE54TkNAMpIsJMC14pvYiihY2wibmIpVX0RbbLKqd+eRY+qLo+5dMX SX/9q41bGSyzvt8Pwk0COP3eLMg2ZuR8i3keXR/Ugag06NeXPkgJ++b/DqwsqlDv6h7+ dJaE04Hrv00OVzAXInk6W742RND5wYHL7IHyjiVU9HtD+l9sgmi/BIP9DZuGBiHDIzVV Rl4hgFqlbrS9uGoF/YYTKpoMUsz8acQVTVOIgh91x4yI55/FFGIeh7pE/6+FAYAlirwH yPRpZ3lT1j/DlxMhxVX5gxm7z6uk+L9PQ0ggSo1OmHOQfC4eMGwm53EBmu/xPLat2a7M jmeA== 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=dcyqLzOqexgUYT665cSkM8WWwCRhPRScopxtXSuIwhE=; b=soZxjU0yVck9VZZhsQ8G5lJERbJmWeCy3onvl6YZCHlp80UzjiNtT9IJwZ1L6alGJn kI9srOfLAATUomEbrKmUHzqVoRea3Pp0wfkB2q7Xuqb5B3A8tRLrXmS6zjDBk7CZuFPF U5PB+bHB//MYHG7X1HOxWjkPfgE/ZKEcmNeXYFs/al+Jk4W2CZYmrSxGFpqZB1G7y9qS vfskjiTnIBbrsxpPK9XWGdJaHnB7V8FwKWzpVi4Ko8TTo1eDQzwGv+OqXLgA8N1drQfm LmGTaBf5GXtFTXHLqciK98bOFNyFFiWDspIUHXB4br8UOflB3baM7ThohZi1+dR7M1dx iLiA== X-Gm-Message-State: APjAAAVvuT5wuTQ5+cAgtLM71TzBwHRL7kvFMeCnxAl/4IXVJ8FsrFlT vIwttxu7yo06mVa3RArctIg= X-Received: by 2002:ac8:1e90:: with SMTP id c16mr54660410qtm.265.1582655393994; Tue, 25 Feb 2020 10:29:53 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id o25sm7843946qkk.7.2020.02.25.10.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 10:29:53 -0800 (PST) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Tue, 25 Feb 2020 13:29:51 -0500 To: Kees Cook Cc: Nick Desaulniers , Arvind Sankar , Fangrui Song , Borislav Petkov , Nathan Chancellor , Thomas Gleixner , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , LKML , clang-built-linux , Michael Matz Subject: Re: --orphan-handling=warn Message-ID: <20200225182951.GA1179890@rani.riverdale.lan> References: <20200109150218.16544-1-nivedita@alum.mit.edu> <20200109150218.16544-2-nivedita@alum.mit.edu> <20200222050845.GA19912@ubuntu-m2-xlarge-x86> <20200222065521.GA11284@zn.tnic> <20200222070218.GA27571@ubuntu-m2-xlarge-x86> <20200222072144.asqaxlv364s6ezbv@google.com> <20200222074254.GB11284@zn.tnic> <20200222162225.GA3326744@rani.riverdale.lan> <202002242122.AA4D1B8@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <202002242122.AA4D1B8@keescook> 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 09:35:04PM -0800, Kees Cook wrote: > > Actually, it's rather opposed to the FGKASLR series, as for that, I need > some kind of linker script directive like this: > > /PASSTHRU/ : { > *(.text.*) > } > > Where "PASSTHRU" would create a 1-to-1 input-section to output-section > with the same name, flags, etc. > > ld.bfd's handling of orphan sections named .text.* is to put them each > as a separate output section, after the existing .text output section. > > ld.lld's handling of orphan sections named .text.* is to put them into > the .text output section. This doesn't match ld's documentation [1] of how orphan sections are to be handled, it's supposed to append it into an existing output section only if the names match exactly, creating a new one if that isn't so. If ld.lld is to be a drop-in replacement for ld.bfd, this probably needs to change? Also ld.lld doesn't seem to support the --unique option, I think you'll also want that for FGKASLR to avoid merging static functions with the same name from unrelated source files. [1] https://sourceware.org/binutils/docs/ld/Orphan-Sections.html > > For FGKASLR (as it is currently implemented[2]), the sections need to be > individually named output sections (as bfd does it). *However*, with the > "warn on orphans" patch, FGKASLR's intentional orphaning will backfire > (I guess the warning could be turned off, but I'd like lld to handle > FGKASLR at some point.) > > Note that cheating and doing the 1-to-1 mapping by handy with a 40,000 > entry linker script ... made ld.lld take about 15 minutes to do the > final link. :( Out of curiosity, how long does ld.bfd take on that linker script :)