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: <20240331062314.3394-1-hdanton@sina.com>
Date: Sun, 31 Mar 2024 14:23:14 +0800
From: Hillf Danton <hdanton@...a.com>
To: Uladzislau Rezki <urezki@...il.com>
CC: syzbot <syzbot+1fa663a2100308ab6eab@...kaller.appspotmail.com>, "Alexei
 Starovoitov" <alexei.starovoitov@...il.com>, "Paul E. McKenney"
	<paulmck@...nel.org>, <linux-kernel@...r.kernel.org>,
	<syzkaller-bugs@...glegroups.com>
Subject: Re: [syzbot] [bpf?] possible deadlock in kvfree_call_rcu

On Sat, 30 Mar 2024 18:55:41 +0100 Uladzislau Rezki <urezki@...il.com>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index d9642dd06c25..8867aac3668c 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3467,19 +3467,19 @@ void kvfree_call_rcu(struct rcu_head *head, void *ptr)
>  	 */
>  	kmemleak_ignore(ptr);
>  
> -	// Set timer to drain after KFREE_DRAIN_JIFFIES.
> -	if (rcu_scheduler_active == RCU_SCHEDULER_RUNNING)
> -		schedule_delayed_monitor_work(krcp);
> -

This is not enough at least WRT run_page_cache_worker() [1]

[1] https://lore.kernel.org/lkml/0000000000007a44120614e27cb7@google.com/

while the reason why syzbot failed to catch the zone->per_cpu_pageset in
setup_zone_pageset() in mm/page_alloc.c is trylock [2]

[2] https://lore.kernel.org/lkml/000000000000a5ee4e0614ee586e@google.com/

>  unlock_return:
>  	krc_this_cpu_unlock(krcp, flags);
>  
> -	/*
> -	 * Inline kvfree() after synchronize_rcu(). We can do
> -	 * it from might_sleep() context only, so the current
> -	 * CPU can pass the QS state.
> -	 */
> -	if (!success) {
> +	if (success) {
> +		// Set timer to drain after KFREE_DRAIN_JIFFIES.
> +		if (rcu_scheduler_active == RCU_SCHEDULER_RUNNING)
> +			schedule_delayed_monitor_work(krcp);
> +	} else {
> +		/*
> +		 * Inline kvfree() after synchronize_rcu(). We can do
> +		 * it from might_sleep() context only, so the current
> +		 * CPU can pass the QS state.
> +		 */
>  		debug_rcu_head_unqueue((struct rcu_head *) ptr);
>  		synchronize_rcu();
>  		kvfree(ptr);
> 
> 
> --


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ