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] [day] [month] [year] [list]
Message-ID: <ZhmXm4xVMY5QPEGn@bombadil.infradead.org>
Date: Fri, 12 Apr 2024 13:20:43 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: Justin Stitt <justinstitt@...gle.com>
Cc: Nathan Chancellor <nathan@...nel.org>,
	Nick Desaulniers <ndesaulniers@...gle.com>,
	Bill Wendling <morbo@...gle.com>, linux-modules@...r.kernel.org,
	linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
	linux-hardening@...r.kernel.org
Subject: Re: [PATCH] kallsyms: replace deprecated strncpy with strscpy

On Fri, Apr 12, 2024 at 06:53:47PM +0000, Justin Stitt wrote:
> strncpy() is deprecated for use on NUL-terminated destination strings
> [1] and as such we should prefer more robust and less ambiguous string
> interfaces. The goal is to remove its use completely [2].
> 
> namebuf is eventually cleaned of any trailing llvm suffixes using
> strstr(). This hints that namebuf should be NUL-terminated.
> 
> static void cleanup_symbol_name(char *s)
> {
> 	char *res;
> 	...
> 	res = strstr(s, ".llvm.");
> 	...
> }
> 
> Due to this, use strscpy() over strncpy() as it guarantees
> NUL-termination on the destination buffer. Drop the -1 from the length
> calculation as it is no longer needed to ensure NUL-termination.
> 
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
> Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html
> Link: https://github.com/KSPP/linux/issues/90 [2]
> Cc: linux-hardening@...r.kernel.org
> Signed-off-by: Justin Stitt <justinstitt@...gle.com>

Thanks! Queued up on modules-next.

  Luis

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ