From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762069AbYDYQBH (ORCPT ); Fri, 25 Apr 2008 12:01:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756606AbYDYQAw (ORCPT ); Fri, 25 Apr 2008 12:00:52 -0400 Received: from mx2.mail.elte.hu ([157.181.151.9]:39511 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756519AbYDYQAv (ORCPT ); Fri, 25 Apr 2008 12:00:51 -0400 Date: Fri, 25 Apr 2008 17:59:53 +0200 From: Ingo Molnar To: Mathieu Desnoyers Cc: Linus Torvalds , Jiri Slaby , David Miller , zdenek.kabelac@gmail.com, rjw@sisk.pl, paulmck@linux.vnet.ibm.com, akpm@linux-foundation.org, linux-ext4@vger.kernel.org, herbert@gondor.apana.org.au, penberg@cs.helsinki.fi, clameter@sgi.com, linux-kernel@vger.kernel.org, Andi Kleen , pageexec@freemail.hu, "H. Peter Anvin" , Jeremy Fitzhardinge Subject: Re: [PATCH 1/1] x86: fix text_poke Message-ID: <20080425155953.GA11243@elte.hu> References: <20080425.021301.193689806.davem@davemloft.net> <1209343883-7991-1-git-send-email-jirislaby@gmail.com> <20080425151931.GA25510@elte.hu> <20080425152650.GA894@elte.hu> <20080425155444.GB9503@Krystal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080425155444.GB9503@Krystal> User-Agent: Mutt/1.5.17 (2007-11-01) X-ELTE-VirusStatus: clean X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.3 -1.5 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Mathieu Desnoyers wrote: > Woooow, just a sec here. I removed the atomicity test _because_ there > happen to be a case where it's safe to do non-atomic instruction > modification. If we do : > > 1) replace the instruction first byte by a breakpoint, execute an > instruction bypass (see the immediate values patches for detail) > 2) modify the instruction non-atomically > 3) put back the original instruction first byte. > > That's why I removed the BUG_ONs at the beginning of the function. > That's also why it's required to deal with page crossing. but the code as-is is nonsensical. It checks for: BUG_ON(len > sizeof(long)); but then deals with page crossing... it should also rename text_poke_early() to text_poke_core(), and call _that_ from text_poke() if core_kernel_text(). From that alone the whole poke_text() function would look a whole lot cleaner. Ingo