Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4027454ybv; Tue, 25 Feb 2020 11:43:49 -0800 (PST) X-Google-Smtp-Source: APXvYqyX1RZrPc/FvXSoOtWWMZN5THr7adWc4SxmFUfz1X4ygEZpcGmdL58n7JtPlrL53qr7hT4s X-Received: by 2002:aca:c514:: with SMTP id v20mr440011oif.62.1582659829407; Tue, 25 Feb 2020 11:43:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582659829; cv=none; d=google.com; s=arc-20160816; b=Uaeg/6YbNcvvJJfuOqe+5RlryWkCk8A/57F4C0A7P8Ttv2IrFe3er1t7yKCJ0+bntu Ffu6eC1T1/zrnLm/tgLerKmZVyAUNio8FRvGDcf+AQleKHBB7Pw0eKvUmsFRIGsGD1w6 3u5vGSvAVo6QExK3MEx7duXQC9Xh3SXrE20PQbxlMg1fF7VgAmasxAkMr9YFLwttpbLk k1EVaUYgNe6b4ETnMlX86aBfTe1Mzr/+DdzGg0N7X2nWgvbqlKN/qUd1T80JpH1Ow8aG BbbsmX2ruhlHjztSAI0z+4mpzWqDg1u03tUHjPVSM3NqfWJeCcNDNAnHnnep0ZfytKt1 /8lg== 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=B3YfOF9RdWClbkrgasFARaQYtBEE4BEedB2tPnWISAw=; b=cHI+wZdhilrWjXyvqybaq8Es98D6ykejqMb6X36046rhiH7PI6Nw9LKRrYhBBDwyYI 9mP21X/FySODYBSpraVu2o1UpQz+IkIdiOG/dzje+vkrp3XSKsNAEDYWJVFdHdMCUvbS 0Ha+3CUlAn+WgGA/oo02DWNoJi0hcCn97P4S8ie3HGzBHe74sRMEErDQ1rI90h3Vxpro 7rCZwXUMaK9yZsX3rijY3SUkvre5C594Fj7BUL7h57qUv7Y2Y7M43ej+8m9Z1HEzrdKJ zlP2XNYgCLstDXkxS8FjVJFDMfZS//IHLRXB5cxJKt13bDh66CBjSB4sBfyvfY2hPRRY vf1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RrJsXoLA; 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 o25si121610otk.28.2020.02.25.11.43.37; Tue, 25 Feb 2020 11:43:49 -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=RrJsXoLA; 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 S1729489AbgBYTnC (ORCPT + 99 others); Tue, 25 Feb 2020 14:43:02 -0500 Received: from mail-pl1-f170.google.com ([209.85.214.170]:37785 "EHLO mail-pl1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728051AbgBYTnC (ORCPT ); Tue, 25 Feb 2020 14:43:02 -0500 Received: by mail-pl1-f170.google.com with SMTP id q4so223268pls.4 for ; Tue, 25 Feb 2020 11:43:00 -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=B3YfOF9RdWClbkrgasFARaQYtBEE4BEedB2tPnWISAw=; b=RrJsXoLAHw+G5clxtlauuLY1hjIS6S8ZYT7r/W0RP0UckpF8t6OgXk/qJuKXZDstfS 7b6XDUaQIOB5ARE2h/mtV5LdX6MMevzPzjPyTGm9uDUOYN8/f2t27TW8KCeyk1SzU3uk vpdo+upjSaggvemoA98wyofX22yAisydyYYSk= 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=B3YfOF9RdWClbkrgasFARaQYtBEE4BEedB2tPnWISAw=; b=Gi5w/lkaFDL9nm4pLZb5mEhK/RA6rR1xUmPxbwla8+Mpnk2pXg8LSL2uKbcpXu+SVP yPbtDsQCp++GmZYLLsK/EE20qZHHp8X5zScVMhsEygKF/8vMx/hyVPwzc1xLKjG2q4B9 czts4nZGnHRTM331oump/IZA6K055/t8vmr4dICqlrqNTcB1cF9syDfqARkKomyUoxT/ Y9/O6E57urg5v9D1GvUKpHAjR/G43sL42KgOzTKY3m0x231z3VRDLCZnzcSxCuCoaWM9 fYcpCNQUoBOKhxa2AZ9rn8UqoI/tySwP+PQ4Tr5OnonkppCN/lh8CLMflstbDQ2ai8NV PAww== X-Gm-Message-State: APjAAAUeWkd24fjGbpgjdszaZOyd8F7YZJ9+E0xUQbS3kNtkT9ku5Rel oW6/VehdjKj5uTyu8nYxhq1BSQ== X-Received: by 2002:a17:902:b089:: with SMTP id p9mr157561plr.42.1582659779668; Tue, 25 Feb 2020 11:42:59 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w18sm17647703pge.4.2020.02.25.11.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 11:42:58 -0800 (PST) Date: Tue, 25 Feb 2020 11:42:58 -0800 From: Kees Cook To: Arvind Sankar Cc: Nick Desaulniers , Fangrui Song , Borislav Petkov , Nathan Chancellor , Thomas Gleixner , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , LKML , clang-built-linux , Michael Matz , Kristen Carlson Accardi Subject: Re: --orphan-handling=warn Message-ID: <202002251140.4F28F0A4F@keescook> References: <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> <20200225182951.GA1179890@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200225182951.GA1179890@rani.riverdale.lan> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 25, 2020 at 01:29:51PM -0500, Arvind Sankar wrote: > 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? That would be lovely! :P > 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. Right, yes, that seems like something we have to depend on. > > [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 :) A single CPU at 100% for 15 minutes. :) -- Kees Cook