From: Kees Cook <keescook@chromium.org>
To: James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: Justin Stitt <justinstitt@google.com>,
Charles Bertsch <cbertsch@cox.net>,
linux-scsi@vger.kernel.org, MPT-FusionLinux.pdl@broadcom.com
Subject: Re: startup BUG at lib/string_helpers.c from scsi fusion mptsas
Date: Thu, 4 Apr 2024 16:57:41 -0700 [thread overview]
Message-ID: <202404041646.7B813E9AD@keescook> (raw)
In-Reply-To: <784db8a20a3ddeb6c0498f2b31719e5198da6581.camel@HansenPartnership.com>
On Thu, Apr 04, 2024 at 06:33:38PM -0400, James Bottomley wrote:
> But additionally this is a common pattern in SCSI: using strncpy to
> zero terminate fields that may be unterminated in the exchange protocol
> so we can send them to sysfs or otherwise treat them as strings. That
> means we might have this problem in other drivers you've converted ...
This use of copying a maybe-NUL-terminated source is yet another weird
corner-case of strncpy(). :(
But it's also easy to check for this "strncpy used with size
matching source size but destination is bigger" case with some build
instrumentation. I'll see what it turns up.
--
Kees Cook
next prev parent reply other threads:[~2024-04-04 23:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 22:43 startup BUG at lib/string_helpers.c from scsi fusion mptsas Charles Bertsch
2024-04-03 23:20 ` Bart Van Assche
2024-04-04 19:58 ` Justin Stitt
2024-04-04 21:38 ` Justin Stitt
2024-04-04 21:53 ` James Bottomley
2024-04-04 22:04 ` Justin Stitt
2024-04-04 22:29 ` James Bottomley
2024-04-04 22:33 ` James Bottomley
2024-04-04 22:43 ` Martin K. Petersen
2024-04-04 22:47 ` Justin Stitt
2024-04-04 23:39 ` Kees Cook
2024-04-05 0:10 ` Justin Stitt
2024-04-05 0:12 ` Justin Stitt
2024-04-04 23:57 ` Kees Cook [this message]
2024-04-06 20:42 ` Charles Bertsch
2024-04-08 19:59 ` Justin Stitt
2024-04-08 23:19 ` Kees Cook
2024-04-10 20:51 ` Justin Stitt
2024-04-10 21:14 ` Charles Bertsch
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=202404041646.7B813E9AD@keescook \
--to=keescook@chromium.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=MPT-FusionLinux.pdl@broadcom.com \
--cc=cbertsch@cox.net \
--cc=justinstitt@google.com \
--cc=linux-scsi@vger.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 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.