Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <936bcf5e-2006-7643-7804-9efa318b3e2b@linuxfoundation.org>
Date: Mon, 22 Feb 2021 09:36:51 -0700
From: Shuah Khan <skhan@...uxfoundation.org>
To: Romain Perier <romain.perier@...il.com>, Kees Cook
 <keescook@...omium.org>, kernel-hardening@...ts.openwall.com,
 Tejun Heo <tj@...nel.org>, Zefan Li <lizefan.x@...edance.com>,
 Johannes Weiner <hannes@...xchg.org>,
 Herbert Xu <herbert@...dor.apana.org.au>,
 "David S. Miller" <davem@...emloft.net>, Jiri Pirko <jiri@...dia.com>,
 Sumit Semwal <sumit.semwal@...aro.org>,
 Christian König <christian.koenig@....com>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 Mimi Zohar <zohar@...ux.ibm.com>, Dmitry Kasatkin
 <dmitry.kasatkin@...il.com>, "J. Bruce Fields" <bfields@...ldses.org>,
 Chuck Lever <chuck.lever@...cle.com>,
 Geert Uytterhoeven <geert@...ux-m68k.org>, Jessica Yu <jeyu@...nel.org>,
 Guenter Roeck <linux@...ck-us.net>, Heiko Carstens <hca@...ux.ibm.com>,
 Vasily Gorbik <gor@...ux.ibm.com>,
 Christian Borntraeger <borntraeger@...ibm.com>,
 Steffen Maier <maier@...ux.ibm.com>, Benjamin Block <bblock@...ux.ibm.com>,
 "Martin K. Petersen" <martin.petersen@...cle.com>,
 Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
 Steven Rostedt <rostedt@...dmis.org>, Ingo Molnar <mingo@...hat.com>,
 Jiri Slaby <jirislaby@...nel.org>, Felipe Balbi <balbi@...nel.org>,
 Valentina Manea <valentina.manea.m@...il.com>, Shuah Khan
 <shuah@...nel.org>, Wim Van Sebroeck <wim@...ux-watchdog.org>
Cc: cgroups@...r.kernel.org, linux-crypto@...r.kernel.org,
 netdev@...r.kernel.org, linux-media@...r.kernel.org,
 dri-devel@...ts.freedesktop.org, linaro-mm-sig@...ts.linaro.org,
 "Rafael J. Wysocki" <rafael@...nel.org>, linux-integrity@...r.kernel.org,
 linux-nfs@...r.kernel.org, linux-m68k@...ts.linux-m68k.org,
 linux-hwmon@...r.kernel.org, linux-s390@...r.kernel.org,
 linux-scsi@...r.kernel.org, target-devel@...r.kernel.org,
 alsa-devel@...a-project.org, linux-usb@...r.kernel.org,
 linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org,
 Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH 00/20] Manual replacement of all strlcpy in favor of
 strscpy

On 2/22/21 8:12 AM, Romain Perier wrote:
> strlcpy() copy a C-String into a sized buffer, the result is always a
> valid NULL-terminated that fits in the buffer, howerver it has severals
> issues. It reads the source buffer first, which is dangerous if it is non
> NULL-terminated or if the corresponding buffer is unbounded. Its safe
> replacement is strscpy(), as suggested in the deprecated interface [1].
> 
> We plan to make this contribution in two steps:
> - Firsly all cases of strlcpy's return value are manually replaced by the
>    corresponding calls of strscpy() with the new handling of the return
>    value (as the return code is different in case of error).
> - Then all other cases are automatically replaced by using coccinelle.
> 

Cool. A quick check shows me 1031 strscpy() calls with no return
checks. All or some of these probably need to be reviewed and add
return checks. Is this something that is in the plan to address as
part of this work?

thanks,
-- Shuah

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.