Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756895Ab2BAUyb (ORCPT ); Wed, 1 Feb 2012 15:54:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47148 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753702Ab2BAUya (ORCPT ); Wed, 1 Feb 2012 15:54:30 -0500 Subject: Re: Memory corruption due to word sharing From: Torvald Riegel To: Linus Torvalds Cc: Jan Kara , LKML , linux-ia64@vger.kernel.org, dsterba@suse.cz, ptesarik@suse.cz, rguenther@suse.de, gcc@gcc.gnu.org In-Reply-To: References: <20120201151918.GC16714@quack.suse.cz> <1328116137.15992.6146.camel@triegel.csb> Content-Type: text/plain; charset="UTF-8" Date: Wed, 01 Feb 2012 21:53:40 +0100 Message-ID: <1328129620.15992.6453.camel@triegel.csb> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1577 Lines: 40 On Wed, 2012-02-01 at 09:29 -0800, Linus Torvalds wrote: > On Wed, Feb 1, 2012 at 9:08 AM, Torvald Riegel wrote: > > > > What do the kernel folks think about the C11 memory model? If you can > > spot any issues in there, the GCC community would certainly like to > > know. > > I don't think this is about memory models except very tangentially. > > Gcc currently accesses fields in a way that affects *independent* > fields, without checking their memory models at all. > > Even original C already has one memory model: "volatile" data is seen > outside the virtual C machine. And Jiri reports that even that > *original* memory model is being violated. We're taling about the one > from about 40 years ago. For volatile, I agree. However, the original btrfs example was *without* a volatile, and that's why I raised the memory model point. This triggered an error in a concurrent execution, so that's memory model land, at least in C language standard. The example was a granularity-of-access violation, I agree. Nonetheless, C11 has rules for that, they have been written down, it would good to know whether these rules are sufficient for you. > We do end up doing > much more aggressive threading, with models that C11 simply doesn't > cover. Any specific examples for that would be interesting. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/