All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Alexander Lobakin <alobakin@pm.me>
Cc: Sami Tolvanen <samitolvanen@google.com>,
	Kees Cook <keescook@chromium.org>, Jessica Yu <jeyu@kernel.org>,
	Miroslav Benes <mbenes@suse.cz>,
	Emil Velikov <emil.l.velikov@gmail.com>,
	Sean Christopherson <seanjc@google.com>,
	"linux-hardening@vger.kernel.org"
	<linux-hardening@vger.kernel.org>,
	linux-kbuild <linux-kbuild@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kbuild: merge module sections under CONFIG_LD_DEAD_CODE_DATA_ELIMINATION too
Date: Wed, 7 Apr 2021 23:24:30 +0900	[thread overview]
Message-ID: <CAK7LNAQBYxZ4s4Eg2TPMoLA+NDWXsNrnq2ch1ZQsBgcCXPk7Sw@mail.gmail.com> (raw)
In-Reply-To: <Gt4--xIFQdFQbd97OwKvRwelvfikSSv3Vkc_KKzAeGgp6c2fe8SPW6v_njp0xvwepPwC_UcWdyWeAjSdFEXpheJWlnmWNY-mVsaMEnJV56A=@pm.me>

On Tue, Apr 6, 2021 at 11:42 PM Alexander Lobakin <alobakin@pm.me> wrote:
>
> On Friday, 2 April 2021, 18:09, Sami
> Tolvanen <samitolvanen@google.com> wrote:
>
> > On Fri, Apr 2, 2021 at 5:40 AM Alexander Lobakin alobakin@pm.me wrote:
> >
> > > When building with CONFIG_LD_DEAD_CODE_DATA_ELIMINATION,
> > > -fdata-sections and -ffunction-sections are being enabled by the
> > > top-level Makefile, and module section merging is also needed.
> > > Expand the ifdef (and the comment block) to cover that case too.
> > > Fixes: 6a3193cdd5e5 ("kbuild: lto: Merge module sections if and only if CONFIG_LTO_CLANG is enabled")


Did you test this patch before submission?


See the top Makefile closely:

ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
LDFLAGS_vmlinux += --gc-sections
endif


-ffunction-sections -fdata-sections are passed to only
built-in objects, but not to module objects in the
first place.

KBUILD_CFLAGS_KERNEL is only passed to built-in objects.


The situation you claimed never happens.







> > Wouldn't this trigger the ld.bfd bug described in the commit message
> > when LD_DEAD_CODE_DATA_ELIMINATION is enabled? LTO_CLANG always uses
> > LLD, so it won't have this issue.
>
> LD_DEAD_CODE_DATA_ELIMINATION is marked
> “EXPERIMENTAL“ in the config prompt, and
> arches have to opt-in
> HAS_LD_DEAD_CODE_DATA_ELIMINATION to give
> an access to it (only a few does). This
> should be relatively safe.
>
> > Sami
>
> Thanks,
> Al



-- 
Best Regards
Masahiro Yamada

      reply	other threads:[~2021-04-07 14:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02 12:40 [PATCH] kbuild: merge module sections under CONFIG_LD_DEAD_CODE_DATA_ELIMINATION too Alexander Lobakin
2021-04-02 15:09 ` Sami Tolvanen
2021-04-06 14:42   ` Alexander Lobakin
2021-04-07 14:24     ` Masahiro Yamada [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK7LNAQBYxZ4s4Eg2TPMoLA+NDWXsNrnq2ch1ZQsBgcCXPk7Sw@mail.gmail.com \
    --to=masahiroy@kernel.org \
    --cc=alobakin@pm.me \
    --cc=emil.l.velikov@gmail.com \
    --cc=jeyu@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=samitolvanen@google.com \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.