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: <alpine.LFD.1.00.0804021237031.14670@woody.linux-foundation.org>
Date:	Wed, 2 Apr 2008 12:44:05 -0700 (PDT)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Mikulas Patocka <mikulas@...ax.karlin.mff.cuni.cz>
cc:	viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org
Subject: Re: [PATCH]: Fix SMP-reordering race in mark_buffer_dirty



On Wed, 2 Apr 2008, Mikulas Patocka wrote:
> +	/*
> +	 * Make sure that the test for buffer_dirty(bh) is not reordered with
> +	 * previous modifications to the buffer data.
> +	 * -- mikulas
> +	 */
> +	smp_mb();
>  	WARN_ON_ONCE(!buffer_uptodate(bh));
>  	if (!buffer_dirty(bh) && !test_set_buffer_dirty(bh))

At that point, the better patch is to just *remove* the buffer_dirty() 
test, and rely on the stronger ordering requirements of 
test_set_buffer_dirty().

The whole - and only - point of the buffer_dirty() check was to avoid the 
more expensive test_set_buffer_dirty() call, but it's only more expensive 
because of the barrier semantics. So if you add a barrier, the point goes 
away and you should instead remove the optimization.

(I also seriously doubt you can actually trigger this in real life, but 
simplifying the code is probably fine regardless).

		Linus
--
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