Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp676486pxf; Wed, 31 Mar 2021 13:09:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvtFIoZW9x1jRTqj0WYAds3NLPF9JOr7QqWObjmhSVRwSNn9YbJMUhvjbBikJ9GyLtuzZP X-Received: by 2002:a17:906:170d:: with SMTP id c13mr5305208eje.491.1617221398812; Wed, 31 Mar 2021 13:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617221398; cv=none; d=google.com; s=arc-20160816; b=v0JDCVmEWDwT0YAgHd72pJwrJG2l6TV+R/xoIsF9BaZM1BqQiSk3JYlQbREpe0QFOF LfrrTA1/W9B3iGzDbZitFr7ndhuIYAFFMGf+xHdD1EC3VjLSA0Pp1r4joREV6SZ3h1cj LmWtLEPTJnvUUfSF3yWkpLPpPe0+2A3NCeRYqqL+1E2q/ljiQblhinpzZGkvWNrj5bqh 2Hbb8gVAQr/5kldlTD51sUyTKywSLwW+edhlZ9SThWGvAxbpLuo/aSFwduyA4V3r2QVC wZcPRGt9ag4mG6X4ac34Rn3eikyHrrOkLjqFF1bxfuoRh0KaoMWJ95zAiS/8fKQvkR/n 4ldw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=j8v7zlQCarZgdFLgATsFe+vW/NFhoDJt/9MWBvCMW3o=; b=OPoGpsRWoUXcmvRIz3itkeZ4sAxmjZmSuA2TD+v1r2CGnHqReG4BqjTYpo6BJXN4Ex YSh2hnq9QvngkSyE1dT+yOZQtBGRI9zd728J9iJKwzyl6rIaJxsLAiW7yTVXZ9eY2zqO 9+m7K1K9UiKq/sa1622iQWZEcC/d63DEpmMaITq3U5LdK6Qq76DtmolHCaV+VyLj7PUN tZUtOx/XFS4ZjFNu8m6zx23hlpc8JLt56hB3I4tuDhW2gSartJ8mSDRLlh6LWfMjG/V6 IUFQahZ1rg1clf8lqfOGn3AWeUdoCAwV5gKaP05NnQXBM4u1OSmynrG44lT+SMErzG0s WJ0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PHWdya59; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si2580492edw.445.2021.03.31.13.09.14; Wed, 31 Mar 2021 13:09:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PHWdya59; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236419AbhCaUHn (ORCPT + 99 others); Wed, 31 Mar 2021 16:07:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236323AbhCaUHX (ORCPT ); Wed, 31 Mar 2021 16:07:23 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EA10C06174A for ; Wed, 31 Mar 2021 13:07:23 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id q10so101288pgj.2 for ; Wed, 31 Mar 2021 13:07:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=j8v7zlQCarZgdFLgATsFe+vW/NFhoDJt/9MWBvCMW3o=; b=PHWdya59ypGDcuhE+/Lj0qikX5VKKJXVdJWzs0hZfbTtT1pTrku9dxeF2BRmS1lpxh YfrvMh564HSSwf9crONrxjhy6Kvwgho+tI9MxKnecxhLK6q7jWUX5JfW1/uFuYuAUXn9 FB7rFnOcSaxSCaHGTwmJj5M5KHbjStoBJjZ7T5lemUwbT9co1C3P2SGvnxkM5xlmc8kZ gYMSH/b7yz7JIPwQxloWvXZhufWderMls7/bo/K2TvhsD4rDuM32hgRZxmGsCzCwe4UH 8KETRP77LjLRCoEX0fuOSTEXA9Z3C9YUd3Z87sCWhxtpwzTmj37e/L2uP8XfHkW+s6El 7nBw== 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=j8v7zlQCarZgdFLgATsFe+vW/NFhoDJt/9MWBvCMW3o=; b=a8ZKkc16R2SI8044uqcKWzFzsOr3sDPJi/WqXpza6bztMjF1uYXXH4Dt65tVVcO/yx dNzCBltUr6J8reH0RhEMZ40envlpTFbJ3z+rmepb8Rslv4i83GkhF6VXhKCVhB8qMbGE 4SXAn+eCalfFqLWmq9COpwsvGFOHIhkASoqF4FpOV9kOzPOs5e61B+cSaW0K5AP/EMz+ DBmcATb0geqEQPOay75CgBNYaQZ7A/JyfY/7JKCW2577eHJ1guv7yHZj2N7qOxnDcgDc yW/BUJ1AfuEaYO/tySjKwv749H4tUXDDTpf8XfCOPNkOwz0meWoj6AkdLzQdZCjBi8bL 6m+w== X-Gm-Message-State: AOAM532ihQmdd8szgVrsmzLk+/g5LDldg9XgOiSdyKHm5oNgGI0+EHd/ wlv8KeHizGbDsZ8ZEGm82Wx0ZQ== X-Received: by 2002:a63:4763:: with SMTP id w35mr4698071pgk.226.1617221242566; Wed, 31 Mar 2021 13:07:22 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id fa21sm3093569pjb.41.2021.03.31.13.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Mar 2021 13:07:21 -0700 (PDT) Date: Wed, 31 Mar 2021 20:07:18 +0000 From: Sean Christopherson To: Kees Cook Cc: Sami Tolvanen , Fangrui Song , Masahiro Yamada , Michal Marek , Nathan Chancellor , Nick Desaulniers , linux-kbuild , LKML , clang-built-linux Subject: Re: [PATCH] kbuild: Merge module sections if and only if CONFIG_LTO_CLANG is enabled Message-ID: References: <20210322234438.502582-1-seanjc@google.com> <202103311228.D42822B@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202103311228.D42822B@keescook> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 31, 2021, Kees Cook wrote: > On Wed, Mar 24, 2021 at 10:45:36PM +0000, Sean Christopherson wrote: > > On Tue, Mar 23, 2021, Sami Tolvanen wrote: > > > On Tue, Mar 23, 2021 at 9:36 AM Sean Christopherson wrote: > > > > > > > > On Tue, Mar 23, 2021, Sami Tolvanen wrote: > > > > > On Mon, Mar 22, 2021 at 4:44 PM Sean Christopherson wrote: > > > > > > > > > > > > Merge module sections only when using Clang LTO. With gcc-10, merging > > > > > > sections does not appear to update the symbol tables for the module, > > > > > > e.g. 'readelf -s' shows the value that a symbol would have had, if > > > > > > sections were not merged. > > > > > > > > > > I'm fine with limiting this to LTO only, but it would be helpful to > > > > > understand which sections are actually getting merged here. > > > > > > > > It doesn't appear to matter which sections get merged, the tables only show the > > > > correct data if there is no merging whatsoever, e.g. allowing merging for any > > > > one of the four types (.bss, .data, .rodata and .text) results in breakage. > > > > AFAICT, merging any sections causes the layout to change and throw off the > > > > symbol tables. > > > > > > Thanks for the clarification. I can reproduce this issue with gcc + > > > bfd if any of the sections are merged, but gcc + lld produces valid > > > symbol tables. > > > > FWIW, clang + bfd also produces mangled tables, so it does appear to be bfd > > specific. > > Are you able to open a bug against bfd for this? Yes? I'll ping you when I run into trouble ;-)