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: <aWZ7SXpUm8TwtUIT@yury>
Date: Tue, 13 Jan 2026 12:05:13 -0500
From: Yury Norov <ynorov@...dia.com>
To: Fushuai Wang <fushuai.wang@...ux.dev>
Cc: tglx@...nel.org, peterz@...radead.org, mathieu.desnoyers@...icios.com,
	akpm@...ux-foundation.org, aliceryhl@...gle.com,
	yury.norov@...il.com, vmalik@...hat.com, kees@...nel.org,
	dave.hansen@...ux.intel.com, luto@...nel.org, mingo@...hat.com,
	bp@...en8.de, hpa@...or.com, rostedt@...dmis.org,
	mhiramat@...nel.org, brauner@...nel.org, jack@...e.cz,
	cyphar@...har.com, linux-kernel@...r.kernel.org, x86@...nel.org,
	linux-trace-kernel@...r.kernel.org, wangfushuai@...du.com
Subject: Re: [PATCH v2 3/6] tracing: Use copy_from_user_nul() instead of
 copy_from_user()

On Mon, Jan 12, 2026 at 03:30:36PM +0800, Fushuai Wang wrote:
> From: Fushuai Wang <wangfushuai@...du.com>
> 
> Use copy_from_user_nul() instead of copy_from_user() to simplify
> the code.
> 
> No functional change.
> 
> Signed-off-by: Fushuai Wang <wangfushuai@...du.com>
> ---
>  kernel/trace/trace.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index baec63134ab6..b6ffd006fcf9 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -11266,10 +11266,9 @@ ssize_t trace_parse_run_command(struct file *file, const char __user *buffer,
>  		if (size >= WRITE_BUFSIZE)
>  			size = WRITE_BUFSIZE - 1;
>  
> -		if (copy_from_user(kbuf, buffer + done, size))
> +		if (copy_from_user_nul(kbuf, buffer + done, size))
>  			return -EFAULT;

This hides the original error. Can you switch it to:

                err = copy_xxx();
                if (err)
                        return err;

I understand that in this case EFAULT is the only possible error, but
the above pattern is really error-prone, and is reproduced again and
again over the kernel.

> -		kbuf[size] = '\0';
>  		buf = kbuf;
>  		do {
>  			tmp = strchr(buf, '\n');
> -- 
> 2.36.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ