From: Kees Cook <keescook@chromium.org>
To: Joe Perches <joe@perches.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
linux-kernel-mentees@lists.linuxfoundation.org,
linux-kernel <linux-kernel@vger.kernel.org>,
Lukas Bulwahn <lukas.bulwahn@gmail.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: deprecated.rst: deprecated strcpy ? (was: [PATCH] checkpatch: add a new check for strcpy/strlcpy uses)
Date: Fri, 8 Jan 2021 11:48:44 -0800 [thread overview]
Message-ID: <202101081147.E1D29E4C8F@keescook> (raw)
In-Reply-To: <9e111f0f673ae6ced12efc01d32eefe8402c7f72.camel@perches.com>
On Thu, Jan 07, 2021 at 04:51:31PM -0800, Joe Perches wrote:
> I still like the stracpy variant I proposed:
>
> https://lore.kernel.org/lkml/24bb53c57767c1c2a8f266c305a670f7@sk2.org/T/#m0627aa770a076af1937cb5c610ed71dab3f1da72
> https://lore.kernel.org/lkml/CAHk-=wgqQKoAnhmhGE-2PBFt7oQs9LLAATKbYa573UO=DPBE0Q@mail.gmail.com/
>
> Linus liked a variant he called copy_string:
>
> https://lore.kernel.org/lkml/CAHk-=wg8vLmmwTGhXM51NpSWJW8RFEAKoXxG0Hu_Q9Uwbjj8kw@mail.gmail.com/
>
> I think the cocci scripts that convert:
>
> strlcpy -> strscpy (only when return value unused)
> str<sln>cpy(array, "string") -> stracpy(foo, "string")
> s[cn]printf -> sysfs_emit
>
> would leave relatively few uses of strcpy and sprintf variants and would
> make it much easier to analyze the remainder uses for potential overflows.
I think that would be lovely; yes. :)
--
Kees Cook
next prev parent reply other threads:[~2021-01-08 19:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 8:23 [PATCH] checkpatch: add a new check for strcpy/strlcpy uses Dwaipayan Ray
2021-01-05 8:44 ` Joe Perches
2021-01-05 8:59 ` Dwaipayan Ray
2021-01-05 9:28 ` deprecated.rst: deprecated strcpy ? (was: [PATCH] checkpatch: add a new check for strcpy/strlcpy uses) Joe Perches
2021-01-07 21:16 ` Kees Cook
2021-01-08 0:51 ` Joe Perches
2021-01-08 10:05 ` David Laight
2021-01-08 19:48 ` Kees Cook [this message]
2021-01-05 10:20 ` [PATCH] checkpatch: add a new check for strcpy/strlcpy uses David Laight
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=202101081147.E1D29E4C8F@keescook \
--to=keescook@chromium.org \
--cc=corbet@lwn.net \
--cc=dwaipayanray1@gmail.com \
--cc=joe@perches.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=torvalds@linux-foundation.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