public inbox for linux-hardening@vger.kernel.org
 help / color / mirror / Atom feed
From: "Luck, Tony" <tony.luck@intel.com>
To: Sami Tolvanen <samitolvanen@google.com>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Chris Li <sparse@chrisli.org>
Cc: "Daniel Gomez" <da.gomez@kernel.org>,
	"Eric Biggers" <ebiggers@kernel.org>,
	"Kees Cook" <kees@kernel.org>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Rusty Russell" <rusty@rustcorp.com.au>,
	"Petr Pavlu" <petr.pavlu@suse.com>,
	"linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>,
	"Malcolm Priestley" <tvboxspy@gmail.com>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Hans Verkuil" <hverkuil@kernel.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linux-hardening@vger.kernel.org"
	<linux-hardening@vger.kernel.org>
Subject: Re: [PATCH 3/3] module: Add compile-time check for embedded NUL characters
Date: Wed, 10 Dec 2025 14:29:45 -0800	[thread overview]
Message-ID: <aTn0WdVv-S_EpQmS@agluck-desk3> (raw)
In-Reply-To: <20251210010020.GA2522829@google.com>

[Added Dan Carpenter and Chris Li]

Dan and Chris,

You're in the git log for sparse wrting/commiting fixes. Can you take
a look at this?  Sami's fix works for me.

-Tony

On Wed, Dec 10, 2025 at 01:00:20AM +0000, Sami Tolvanen wrote:
> On Tue, Dec 09, 2025 at 10:29:06AM -0800, Luck, Tony wrote:
> > On Tue, Dec 09, 2025 at 08:45:14AM -0800, Luck, Tony wrote:
> > > On Tue, Dec 09, 2025 at 04:20:06PM +0000, Luck, Tony wrote:
> > > > >> Likewise, I just got the following kernel test robot report sent to me,
> > > > >> where it's warning about MODULE_LICENSE("GPL"):
> > > > >> https://lore.kernel.org/all/202512090359.7BkUaiC9-lkp@intel.com/
> > > > >
> > > > > Can you both confirm which version of sparse are you using?
> > > > >
> > > > > My understanding was that this patch fixed that problem:
> > > > > >https://lore.kernel.org/linux-sparse/CACePvbVG2KrGQq4cNKV=wbO5h=jp3M0RO1SdfX8kV4OukjPG8A@mail.gmail.com/T/#mf838b3e2e3245d88c30a801ea7473d5a5c0eb121
> > > > 
> > > > > The patch is already merged into the sparse tree, and I was not able to
> > > > > reproduce the issue.
> > > > 
> > > > I pulled the latest sparse source and re-checked before reporting. Top commit I have is the one you mention:
> > > > 
> > > > fbdde3127b83 ("builtin: implement __builtin_strlen() for constants")
> > > > 
> > > > I'm building latest Linus tree from the current merge window (well latest as-of yesterday):
> > > > 
> > > > c2f2b01b74be ("Merge tag 'i3c/for-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux")
> > > 
> > > I added a debug trace to the new expand_strlen() function added to
> > > sparse. It is being called and doing the right thing. My trace says:
> > > 
> > > 	len(GPL) = 3
> > 
> > Simple test case:
> > 
> > $ cat -n s.c
> >      1
> >      2  _Static_assert(sizeof("GPL") - 1 == 3, "sizeof");
> >      3
> >      4  _Static_assert(__builtin_strlen("GPL") == 3, "strlen");
> > 
> > $ sparse s.c
> > s.c:4:40: error: bad integer constant expression
> > s.c:4:40: error: static assertion failed: "strlen"
> > 
> > So the "sizeof" bit is OK. But the __builtin_strlen() isn't.
> 
> This looks like a bug in Sparse. The CEF_ICE flag isn't propagated to
> the comparison expression, which it presumably should be when both
> sides are integer constant expressions.
> 
> I'm not really familiar enough with Sparse to know whether this is the
> correct place to handle this case, but this quick hack fixes the issue
> for me:
> 
> diff --git a/expand.c b/expand.c
> index f14e7181..71221d35 100644
> --- a/expand.c
> +++ b/expand.c
> @@ -535,6 +535,8 @@ static int expand_compare(struct expression *expr)
>  			expr->taint = 0;
>  			return 0;
>  		}
> +		if (left->flags & CEF_ICE && right->flags & CEF_ICE)
> +			expr->flags |= CEF_SET_ICE;
>  		if (simplify_cmp_binop(expr, left->ctype))
>  			return 0;
>  		if (simplify_float_cmp(expr, left->ctype))
> 
> Sami

  reply	other threads:[~2025-12-10 22:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-08  3:59 [PATCH 0/3] module: Add compile-time check for embedded NUL characters Kees Cook
2025-10-08  3:59 ` [PATCH 1/3] media: dvb-usb-v2: lmedm04: Fix firmware macro definitions Kees Cook
2025-10-08  6:24   ` Hans Verkuil
2025-10-08  3:59 ` [PATCH 2/3] media: radio: si470x: Fix DRIVER_AUTHOR macro definition Kees Cook
2025-10-08  6:24   ` Hans Verkuil
2025-10-08  3:59 ` [PATCH 3/3] module: Add compile-time check for embedded NUL characters Kees Cook
2025-10-08  9:55   ` Petr Pavlu
2025-12-08 21:05   ` Luck, Tony
2025-12-09  0:11     ` Eric Biggers
2025-12-09  8:18       ` Daniel Gomez
2025-12-09 16:20         ` Luck, Tony
2025-12-09 16:45           ` Luck, Tony
2025-12-09 18:29             ` Luck, Tony
2025-12-10  1:00               ` Sami Tolvanen
2025-12-10 22:29                 ` Luck, Tony [this message]
2025-12-11  8:28                   ` Dan Carpenter
2025-12-11 17:03                     ` Sami Tolvanen
2025-12-11 17:30                       ` Daniel Gomez
2025-12-11 17:51                         ` Sami Tolvanen
2025-12-19 12:45                         ` Dan Carpenter
2025-12-19 16:21                           ` Luck, Tony
2026-01-08  8:49                             ` Andy Shevchenko
2026-02-18  6:50                               ` Dmitry Torokhov
2026-02-19 17:04                             ` Chris Li
2025-10-08  6:27 ` [PATCH 0/3] " Hans Verkuil

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=aTn0WdVv-S_EpQmS@agluck-desk3 \
    --to=tony.luck@intel.com \
    --cc=da.gomez@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=ebiggers@kernel.org \
    --cc=hverkuil@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=petr.pavlu@suse.com \
    --cc=rusty@rustcorp.com.au \
    --cc=samitolvanen@google.com \
    --cc=sparse@chrisli.org \
    --cc=tvboxspy@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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