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: <20250803023439.3760-1-hdanton@sina.com>
Date: Sun,  3 Aug 2025 10:34:38 +0800
From: Hillf Danton <hdanton@...a.com>
To: Yunseong Kim <ysk@...lloc.com>
Cc: Dmitry Vyukov <dvyukov@...gle.com>,
	Andrey Konovalov <andreyknvl@...il.com>,
	linux-kernel@...r.kernel.org,
	Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Uladzislau Rezki <urezki@...il.com>
Subject: Re: [PATCH v2] kcov, usb: Fix invalid context sleep in softirq path on PREEMPT_RT

On Sat,  2 Aug 2025 14:26:49 +0000 Yunseong Kim wrote:
> @@ -862,7 +879,7 @@ void kcov_remote_start(u64 handle)
>  	if (!in_task() && !in_softirq_really())
>  		return;
>  
> -	local_lock_irqsave(&kcov_percpu_data.lock, flags);
> +	local_irq_save(flags);
>  
>  	/*
>  	 * Check that kcov_remote_start() is not called twice in background
> @@ -870,7 +887,7 @@ void kcov_remote_start(u64 handle)
>  	 */
>  	mode = READ_ONCE(t->kcov_mode);
>  	if (WARN_ON(in_task() && kcov_mode_enabled(mode))) {
> -		local_unlock_irqrestore(&kcov_percpu_data.lock, flags);
> +		local_irq_restore(flags);
>  		return;
>  	}
>  	/*
> @@ -879,15 +896,15 @@ void kcov_remote_start(u64 handle)
>  	 * happened while collecting coverage from a background thread.
>  	 */
>  	if (WARN_ON(in_serving_softirq() && t->kcov_softirq)) {
> -		local_unlock_irqrestore(&kcov_percpu_data.lock, flags);
> +		local_irq_restore(flags);
>  		return;
>  	}
>  
> -	spin_lock(&kcov_remote_lock);
> +	raw_spin_lock(&kcov_remote_lock);
>  	remote = kcov_remote_find(handle);
>  	if (!remote) {
> -		spin_unlock(&kcov_remote_lock);
> -		local_unlock_irqrestore(&kcov_percpu_data.lock, flags);
> +		raw_spin_unlock(&kcov_remote_lock);
> +		local_irq_restore(flags);
>  		return;
>  	}
>  	kcov_debug("handle = %llx, context: %s\n", handle,
> @@ -908,17 +925,17 @@ void kcov_remote_start(u64 handle)
>  		size = CONFIG_KCOV_IRQ_AREA_SIZE;
>  		area = this_cpu_ptr(&kcov_percpu_data)->irq_area;
>  	}
> -	spin_unlock(&kcov_remote_lock);
> +	raw_spin_unlock(&kcov_remote_lock);
>  
>  	/* Can only happen when in_task(). */
>  	if (!area) {
> -		local_unlock_irqrestore(&kcov_percpu_data.lock, flags);
> +		local_irq_restore(flags);
>  		area = vmalloc(size * sizeof(unsigned long));

Given irq disabled for the duration of the coverage collection section [1],
vmalloc does not work here [2].

>  		if (!area) {
>  			kcov_put(kcov);
>  			return;
>  		}
> -		local_lock_irqsave(&kcov_percpu_data.lock, flags);
> +		local_irq_save(flags);
>  	}

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/kcov.h#n73
[2] Subject: [RFC 0/7] vmallloc and non-blocking GFPs
https://lore.kernel.org/all/20250704152537.55724-1-urezki@gmail.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ