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]
Message-ID: <20241008211257.6c9c9f88@rorschach.local.home>
Date: Tue, 8 Oct 2024 21:12:57 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Justin Stitt <justinstitt@...gle.com>
Cc: Masami Hiramatsu <mhiramat@...nel.org>, Mathieu Desnoyers
 <mathieu.desnoyers@...icios.com>, linux-kernel@...r.kernel.org,
 linux-trace-kernel@...r.kernel.org, linux-hardening@...r.kernel.org, Kees
 Cook <kees@...nel.org>
Subject: Re: [PATCH] tracing: replace multiple deprecated strncpy with
 strscpy

On Mon, 30 Sep 2024 17:03:45 -0700
Justin Stitt <justinstitt@...gle.com> 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.
> 
> We expect the @pattern and @num_buf strings to be NUL-terminated, as
> evidenced by their manual NUL-byte assignments immediately following
> each copy.
> 
> Switch to using strscpy which guarantees NUL-termination for the
> destination buffer -- eschewing manual NUL-byte assignments. strscpy
> does not NUL-pad so to keep this behavior zero-allocate @num_buf. @pred
> is already zero-allocated before the copies.
> 	pred = kzalloc(sizeof(*pred), GFP_KERNEL);
> 
> This should result in no behavioral changes whilst helping towards the
> goal of [2] -- with the ultimate goal of removing strncpy in favor of
> less ambiguous and more robust alternatives.
> 
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
> Link: https://github.com/KSPP/linux/issues/90 [2]
> Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html
> Cc: Kees Cook <keescook@...omium.org>
> Cc: linux-hardening@...r.kernel.org
> Signed-off-by: Justin Stitt <justinstitt@...gle.com>

So this breaks my tests. This is why I have trouble with taking changes
like this :-(

Before this patch, his worked:

 # echo 'common_pid != 0 && common_pid != 120 && common_pid != 1253 && common_pid != 17 && common_pid != 394 && common_pid != 81 && common_pid != 87' > /sys/kernel/tracing/events/sched/sched_switch/filter

But now it gives an error of:

 -bash: echo: write error: Invalid argument

I have to drop this.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ