mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Nate Karstens <nate.karstens@garmin.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <horms@kernel.org>,
	<john.fastabend@gmail.com>, <kuba@kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux@treblig.org>,
	<mrpre@163.com>, <nate.karstens@gmail.com>,
	<netdev@vger.kernel.org>, <pabeni@redhat.com>,
	<stable@vger.kernel.org>, <tom@quantonium.net>
Subject: Re: [PATCH] strparser: Fix signed/unsigned mismatch bug
Date: Wed, 5 Nov 2025 14:29:24 -0800	[thread overview]
Message-ID: <1097ef25-d36e-4cbb-96cb-7516c1f640e7@intel.com> (raw)
In-Reply-To: <20251105173434.1404676-1-nate.karstens@garmin.com>


[-- Attachment #1.1: Type: text/plain, Size: 1677 bytes --]



On 11/5/2025 9:34 AM, Nate Karstens wrote:
> All right, one more time using `git send-email` (plainly I don't do this every day)...
> 
> Sabrina,
> 
> Thanks for looking at this!
> 
> I'm seeing this on kernel version 5.10.244. I know that ktls on the mainline kernel has moved away from strparser, but I think the change would be useful for anyone still using strparser (both for ktls on old kernels and other users as well). It seems that, because head->len was cast to ssize_t, it was an oversight that skb->len wasn't as well (if the intention was to use unsigned arithmetic, then there would be no need to cast head-> len).
>

Right.
> Here is an example of the values involved with the test I'm running:
> 
> len = 16406
> head->len = 1448
> skb->len = 1448
> stm->strp.offset = 478
> (ssize_t)head->len - skb->len - stm.strp.offset = 4294966818

So, without the ssize_t, I guess everything switches back to unsigned
here when subtracting skb->len..

I don't quite recall the signed vs unsigned rules for this. Is
stm.strp.offset also unsigned? which means that after head->len -
skb->len resolves to unsigned 0 then we underflow?
> (ssize_t)head->len - (ssize_t)skb->len - stm.strp.offset = -478

Where as here, it resolves to signed 0, so we go ultimately resolve to a
signed result?

> 
> I'm happy to update the patch, how much of this information would be useful to include in the commit message?
> 

If we don't actually use the strparser code anywhere then it could be
dropped? But otherwise I agree with Nate that we shouldn't leave this
mistake in place, even if its not actually used by kTLS anymore.

Thanks,
Jake


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  reply	other threads:[~2025-11-05 22:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 17:42 Nate Karstens
2025-11-04 23:28 ` Sabrina Dubroca
2025-11-05 17:34 ` Nate Karstens
2025-11-05 22:29   ` Jacob Keller [this message]
2025-11-05 23:12     ` Nate Karstens
2025-11-05 23:47       ` Jacob Keller
2025-11-06 15:22         ` Sabrina Dubroca
2025-11-06 16:36           ` Nate Karstens
2025-11-06 16:51             ` [PATCH net v2] " Nate Karstens
2025-11-06 22:22               ` Jakub Kicinski

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=1097ef25-d36e-4cbb-96cb-7516c1f640e7@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@treblig.org \
    --cc=mrpre@163.com \
    --cc=nate.karstens@garmin.com \
    --cc=nate.karstens@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=tom@quantonium.net \
    /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

all inboxes | Powered by JetHome®