From: Nathan Chancellor <nathan@kernel.org>
To: Nicolas Schier <nsc@kernel.org>
Cc: Jaihind Yadav <jaihindy@qti.qualcomm.com>,
"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: Mon, 3 Aug 2026 11:12:17 -0700 [thread overview]
Message-ID: <20260803181217.GB1067866@ax162> (raw)
In-Reply-To: <amPIsTxtNPhbDU-z@levanger>
On Fri, Jul 24, 2026 at 10:18:57PM +0200, Nicolas Schier wrote:
> On Wed, Jul 22, 2026 at 07:00:43PM +0000, Jaihind Yadav wrote:
> >
> > Hi Nicolas Schier,
> >
> > Thanks for the suggestion. I tested the proposed change:
> >
> > -kstack-erase-cflags-y += -fplugin=$(objtree)/scripts/gcc-plugins/stackleak_plugin.so
> > +kstack-erase-cflags-y += -fplugin=scripts/gcc-plugins/stackleak_plugin.so
> >
> >
> > Unfortunately, it does not work for the out-of-tree module builds in
> > my environment.
>
> Thanks for checking; and yes I forgot out-of-tree modules. When
> building them, Kbuild changes to their respective output directory so my
> suggestion had to fail for oot kmods.
Technically, this is only a problem for out of tree kernel modules,
right? When building in-tree kernel modules, objtree is always '.', so
we will never have the output directory path in the debug information
(at least based on my brief testing).
> > Given that the proposed relative path breaks out-of-tree module
> > builds, could you please take a look at the patch I posted? If the
> > approach looks reasonable, I would appreciate your review and
> > consideration for merging it.
>
> I am not sure, if we can take your path, as 'readlink --relative-to' is
> only available in coreutils/Linux but coreutils are not a documented
> requirement for Linux builds (cp. Documentation/process/changes.rst),
> thus this would probably kill Linux builds on BSDs and Darwin/MacOS.
>
> But let me think about that a few days; and perhaps someone else comes
> up with an idea.
Yeah, I don't really like 'realpath --relative-to' either, it feels a
bit like a hack since it will only avoid including a full path if the
module output directory includes part of the build directory. For
example:
O=/mnt/build/kernel
MO=/mnt/build/extmod
$ realpath -m --relative-to /mnt/build/extmod /mnt/build/kernel
../kernel
vs.
O=/home/nathan/build/kernel
MO=/mnt/build/extmod
$ realpath -m --relative-to /mnt/build/extmod /home/nathan/build/kernel
../../../home/nathan/build/kernel
Furthermore, this patch only fixes KSTACK_ERASE but we have other GCC
plugins that presumably have the same problem.
I do not have a good solution for this either but since it only affects
external kernel modules, I am not particularly inclined to think too
hard about it.
--
Cheers,
Nathan
next prev parent reply other threads:[~2026-08-03 18:12 UTC|newest]
Thread overview: 18+ 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 [this message]
2026-08-12 10:55 ` Jaihind Yadav
2026-08-12 16:48 ` Nathan Chancellor
2026-08-13 8:29 ` [PATCH v2] kstack_erase: suppress -grecord-gcc-switches for external module builds Jaihind Yadav
2026-08-13 16:42 ` Kees Cook
2026-08-14 8:27 ` Jaihind Yadav
2026-08-14 18:23 ` Nicolas Schier
2026-08-14 22:45 ` Nathan Chancellor
2026-08-16 8:11 ` Jaihind Yadav
2026-08-17 18:51 ` Nathan Chancellor
2026-08-19 5:03 ` Jaihind Yadav
2026-08-20 6:01 ` [PATCH v3] scripts/gcc-plugins: suppress recorded GCC switches for extmod builds Jaihind Yadav
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=20260803181217.GB1067866@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