Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Jaihind Yadav <jaihindy@qti.qualcomm.com>
Cc: Nicolas Schier <nsc@kernel.org>,
	"kees@kernel.org" <kees@kernel.org>,
	"linux-kbuild@vger.kernel.org" <linux-kbuild@vger.kernel.org>,
	"linux-hardening@vger.kernel.org"
	<linux-hardening@vger.kernel.org>,
	"gustavoars@kernel.org" <gustavoars@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] scripts: kstack_erase: use relative stackleak plugin path
Date: Wed, 12 Aug 2026 09:48:50 -0700	[thread overview]
Message-ID: <20260812164850.GA104682@ax162> (raw)
In-Reply-To: <CY5PR02MB89911C30B7E51FE706061818E2DC2@CY5PR02MB8991.namprd02.prod.outlook.com>

On Wed, Aug 12, 2026 at 10:55:38AM +0000, Jaihind Yadav wrote:
> Hi Nathan And Nicolas ,
> 
> Thanks for the feedback.
> 
> I took another look at this and experimented with a different approach for external modules:
> 
> diff --git a/scripts/Makefile.kstack_erase b/scripts/Makefile.kstack_erase
> index ee7e4ef7b892..xxxxxxxxxxxx 100644
> --- a/scripts/Makefile.kstack_erase
> +++ b/scripts/Makefile.kstack_erase
> @@ -5,6 +5,10 @@ kstack-erase-cflags-y += -fplugin=$(objtree)/scripts/gcc-plugins/stackleak_plugin.so
>  kstack-erase-cflags-y += -fplugin-arg-stackleak_plugin-track-min-size=$(CONFIG_KSTACK_ERASE_TRACK_MIN_SIZE)
>  kstack-erase-cflags-y += -fplugin-arg-stackleak_plugin-arch=$(SRCARCH)
>  kstack-erase-cflags-$(CONFIG_GCC_PLUGIN_STACKLEAK_VERBOSE) += -fplugin-arg-stackleak_plugin-verbose
> +ifneq ($(KBUILD_EXTMOD),)
> +# Avoid embedding absolute -fplugin paths into external module DWARF metadata.
> +kstack-erase-cflags-y += -gno-record-gcc-switches
> +endif
>  DISABLE_KSTACK_ERASE := -fplugin-arg-stackleak_plugin-disable
>  endif
> 
> In my testing, this prevents the absolute stackleak plugin path specified via
> 
>     -fplugin=$(objtree)/scripts/gcc-plugins/stackleak_plugin.so
> 
> from being recorded in the DWARF information of out-of-tree modules, while avoiding the use of platform-specific utilities such as realpath/readlink --relative-to.
> 
> I agree this does not solve the broader issue for all GCC plugins, but it appears to address the specific KSTACK_ERASE case that originally motivated the discussion.
> 
> Would this direction be more acceptable than the previous relative-path approach, or would suppressing GCC switch recording for external modules be considered undesirable from a debugging-information perspective?

This seems more reasonable to me. You could save a couple of lines by
making it

  kstack-erase-cflags-$(if $(KBUILD_EXTMOD),y) += -gno-record-gcc-switches

but I guess that is personal style. I doubt it would hamper debugging to
have this done unconditionally but we could always revisit it if someone
complains.

-- 
Cheers,
Nathan

      reply	other threads:[~2026-08-12 16:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20  9:35 [PATCH 0/1] scripts: kstack_erase: avoid absolute stackleak plugin path Jaihind Yadav
2026-07-20  9:35 ` [PATCH 1/1] scripts: kstack_erase: use relative " Jaihind Yadav
2026-07-22 14:45   ` Nicolas Schier
2026-07-22 17:17     ` Jaihind Yadav
2026-07-22 19:00       ` Jaihind Yadav
2026-07-24 20:18         ` Nicolas Schier
2026-08-03 18:12           ` Nathan Chancellor
2026-08-12 10:55             ` Jaihind Yadav
2026-08-12 16:48               ` Nathan Chancellor [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=20260812164850.GA104682@ax162 \
    --to=nathan@kernel.org \
    --cc=gustavoars@kernel.org \
    --cc=jaihindy@qti.qualcomm.com \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nsc@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox