lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 22 Dec 2023 09:59:12 +0900
From: Tejun Heo <tj@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Azeem Shaikh <azeemshaikh38@...il.com>,
	Zefan Li <lizefan.x@...edance.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Waiman Long <longman@...hat.com>,
	Christophe JAILLET <christophe.jaillet@...adoo.fr>,
	linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
	bpf@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v3 2/3] kernfs: Convert kernfs_name_locked() from
 strlcpy() to strscpy()

On Tue, Dec 12, 2023 at 01:17:39PM -0800, Kees Cook wrote:
> strlcpy() reads the entire source buffer first. This read may exceed
> the destination size limit. This is both inefficient and can lead
> to linear read overflows if a source string is not NUL-terminated[1].
> Additionally, it returns the size of the source string, not the
> resulting size of the destination string. In an effort to remove strlcpy()
> completely[2], replace strlcpy() here with strscpy().
> 
> Nothing actually checks the return value coming from kernfs_name_locked(),
> so this has no impact on error paths. The caller hierarchy is:
> 
> kernfs_name_locked()
>         kernfs_name()
>                 pr_cont_kernfs_name()
>                         return value ignored
>                 cgroup_name()
>                         current_css_set_cg_links_read()
>                                 return value ignored
>                         print_page_owner_memcg()
>                                 return value ignored
> 
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [1]
> Link: https://github.com/KSPP/linux/issues/89 [2]
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Tejun Heo <tj@...nel.org>
> Cc: Azeem Shaikh <azeemshaikh38@...il.com>
> Link: https://lore.kernel.org/r/20231116192127.1558276-2-keescook@chromium.org
> Signed-off-by: Kees Cook <keescook@...omium.org>

Acked-by: Tejun Heo <tj@...nel.org>

Thanks.

-- 
tejun

Powered by blists - more mailing lists