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: <cf66d322-ff98-4f50-a27c-52fad11c40e9@paulmck-laptop>
Date: Thu, 11 Sep 2025 12:46:11 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Kaushlendra Kumar <kaushlendra.kumar@...el.com>
Cc: dave@...olabs.net, josh@...htriplett.org, frederic@...nel.org,
	neeraj.upadhyay@...nel.org, rostedt@...dmis.org,
	linux-kernel@...r.kernel.org, rcu@...r.kernel.org
Subject: Re: [PATCH] refperf: Set reader_tasks to NULL after kfree()

On Thu, Sep 11, 2025 at 08:48:11AM +0530, Kaushlendra Kumar wrote:
> Set reader_tasks to NULL after kfree() in ref_scale_cleanup() to
> improve debugging experience with kernel debugging tools. This
> follows the common pattern of NULLing pointers after freeing to
> avoid dangling pointer issues during debugging sessions.
> 
> Setting pointers to NULL after freeing helps debugging tools like
> kdgb,drgn, and other kernel debuggers by providing clear indication
> that the memory has been freed and the pointer is no longer valid.
> 
> Suggested-by: Paul E. McKenney <paulmck@...nel.org>
> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@...el.com>

Queued for further review and testing, thank you!

							Thanx, Paul

> ---
>  kernel/rcu/refscale.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
> index 2bfa987f4ba9..47486dff43ca 100644
> --- a/kernel/rcu/refscale.c
> +++ b/kernel/rcu/refscale.c
> @@ -1048,6 +1048,7 @@ ref_scale_cleanup(void)
>  					     reader_tasks[i].task);
>  	}
>  	kfree(reader_tasks);
> +	reader_tasks = NULL;
>  
>  	torture_stop_kthread("main_task", main_task);
>  
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ