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: <20100423120054.0987f3e4@lxorguk.ukuu.org.uk>
Date:	Fri, 23 Apr 2010 12:00:54 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Dave Airlie <airlied@...il.com>
Cc:	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: Locking question for DRM

> > I don't think that works. drm_open_helper doesn't appear to be under the
> > BKL merely the struct mutex.
> 
> It blocks the case you specified of two releases happening together.

But not parallel open/release

> > But setmaster can sleep so the BKL is dropped on contention of the
> > struct_mutex, ditto dropmaster
> 
> they should only sleep in the mutex lock nuless the driver callback is
> allocating memory. but yeah its a bit of a mess.

With the mutex alone the damage is done. Consider two setmasters and some
other action which is making the mutex contend

		CPU1				CPU2

file->priv->minor->master == NULL ?
file_priv->minor->master != file_priv->master

mutex_lock	(drop BKL)
				file->priv->minor->master === NULL
				master != file_priv->master
				mutex_lock   [drop BKL]
takes mutex
minor->master = drm_master_get
is_master = 1
master_set
drop mutex
return 0
				takes mutex
				minor->master = drm_master_get
				is_master = 1
				master_set
				drops mutex
				return 0


Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ