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: <2025080212-expediter-sinless-4d9c@gregkh>
Date: Sat, 2 Aug 2025 22:30:23 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Yunseong Kim <ysk@...lloc.com>
Cc: Dmitry Vyukov <dvyukov@...gle.com>,
	Andrey Konovalov <andreyknvl@...il.com>,
	Byungchul Park <byungchul@...com>, max.byungchul.park@...il.com,
	"ppbuk5246 @ gmail . com" <ppbuk5246@...il.com>,
	linux-kernel@...r.kernel.org,
	Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
	Alan Stern <stern@...land.harvard.edu>,
	Thomas Gleixner <tglx@...utronix.de>,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	stable@...r.kernel.org, kasan-dev@...glegroups.com,
	syzkaller@...glegroups.com, linux-usb@...r.kernel.org,
	linux-rt-devel@...ts.linux.dev
Subject: Re: [PATCH v2] kcov, usb: Fix invalid context sleep in softirq path
 on PREEMPT_RT

On Sat, Aug 02, 2025 at 02:26:49PM +0000, Yunseong Kim wrote:
> The KCOV subsystem currently utilizes standard spinlock_t and local_lock_t
> for synchronization. In PREEMPT_RT configurations, these locks can be
> implemented via rtmutexes and may therefore sleep. This behavior is
> problematic as kcov locks are sometimes used in atomic contexts or protect
> data accessed during critical instrumentation paths where sleeping is not
> permissible.
> 
> Address these issues to make kcov PREEMPT_RT friendly:
> 
> 1. Convert kcov->lock and kcov_remote_lock from spinlock_t to
>    raw_spinlock_t. This ensures they remain true, non-sleeping
>    spinlocks even on PREEMPT_RT kernels.
> 
> 2. Refactor the KCOV_REMOTE_ENABLE path to move memory allocations
>    out of the critical section. All necessary struct kcov_remote
>    structures are now pre-allocated individually in kcov_ioctl()
>    using GFP_KERNEL (allowing sleep) before acquiring the raw
>    spinlocks.
> 
> 3. Modify the ioctl handling logic to utilize these pre-allocated
>    structures within the critical section. kcov_remote_add() is
>    modified to accept a pre-allocated structure instead of allocating
>    one internally.
> 
> 4. Remove the local_lock_t protection for kcov_percpu_data in
>    kcov_remote_start/stop(). Since local_lock_t can also sleep under
>    RT, and the required protection is against local interrupts when
>    accessing per-CPU data, it is replaced with explicit
>    local_irq_save/restore().

why isn't this 4 different patches?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ