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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <811a97651e144b83a35fd7eb713aeeae@AcuMS.aculab.com>
Date:   Fri, 1 Dec 2023 18:30:05 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Jann Horn' <jannh@...gle.com>, Jens Axboe <axboe@...nel.dk>,
        "Pavel Begunkov" <asml.silence@...il.com>,
        io-uring <io-uring@...r.kernel.org>
CC:     kernel list <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        Waiman Long <longman@...hat.com>
Subject: RE: io_uring: incorrect assumption about mutex behavior on unlock?

From: Jann Horn
> Sent: 01 December 2023 16:41
> 
> mutex_unlock() has a different API contract compared to spin_unlock().
> spin_unlock() can be used to release ownership of an object, so that
> as soon as the spinlock is unlocked, another task is allowed to free
> the object containing the spinlock.
> mutex_unlock() does not support this kind of usage: The caller of
> mutex_unlock() must ensure that the mutex stays alive until
> mutex_unlock() has returned.

The problem sequence might be:
	Thread A		Thread B
	mutex_lock()
				code to stop mutex being requested
				...
				mutex_lock() - sleeps
	mutex_unlock()...
		Waiters woken...
		isr and/or pre-empted
				- wakes up
				mutex_unlock()
				free()
		... more kernel code access the mutex
		BOOOM

What happens in a PREEMPT_RT kernel where most of the spin_unlock()
get replaced by mutex_unlock().
Seems like they can potentially access a freed mutex?

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ