Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Mon, 23 Jul 2001 13:50:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Mon, 23 Jul 2001 13:50:39 -0400 Received: from penguin.e-mind.com ([195.223.140.120]:35169 "EHLO penguin.e-mind.com") by vger.kernel.org with ESMTP id ; Mon, 23 Jul 2001 13:50:27 -0400 Date: Mon, 23 Jul 2001 19:50:55 +0200 From: Andrea Arcangeli To: Linus Torvalds Cc: Jeff Dike , user-mode-linux-user@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: user-mode port 0.44-2.4.7 Message-ID: <20010723195055.A16919@athlon.random> In-Reply-To: <20010723184528.R822@athlon.random> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ; from torvalds@transmeta.com on Mon, Jul 23, 2001 at 10:32:32AM -0700 X-GnuPG-Key-URL: http://e-mind.com/~andrea/aa.gnupg.asc X-PGP-Key-URL: http://e-mind.com/~andrea/aa.asc Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Original-Recipient: rfc822;linux-kernel-outgoing On Mon, Jul 23, 2001 at 10:32:32AM -0700, Linus Torvalds wrote: > > On Mon, 23 Jul 2001, Andrea Arcangeli wrote: > > > > it's the other way around, it's needed and gcc trapped a kernel bug. > > No it's not. > > > If the contents of memory not declared volatile changes under GCC (like > > it can happen right now for xtime since it's declared non volatile), gcc > > has the full rights to crash the kernel at runtime. > > Absolutely not. > > If we care abotu the thing always having the same value, we HAVE to use a > lock. "volatile" is not the answer. > > Show me a place where we care. The problem is not at the source code level, of course all places where we read the xtime cannot crash the kernel as far as the kernel is concerned, but the problem is instead at the gcc level: and when the logic implemented by the asm generated by gcc chokes we can also get a dangling poitner and crash in the kernel. GCC internally is allowed to generate code that relies on the contents of the memory to stay constant, this because of the C standard, the usual example is a fast path jump table for the "case" statement. So in short having non volatile memory that changes under gcc gives gcc the full rights to crash the kernel at runtime anytime. Andrea - 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/