From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755978Ab3LDSdU (ORCPT ); Wed, 4 Dec 2013 13:33:20 -0500 Received: from terminus.zytor.com ([198.137.202.10]:60546 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752889Ab3LDSdT (ORCPT ); Wed, 4 Dec 2013 13:33:19 -0500 Message-ID: <529F7527.5040201@zytor.com> Date: Wed, 04 Dec 2013 10:32:07 -0800 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Linus Torvalds CC: Oleg Nesterov , Hugh Dickins , Peter Zijlstra , Jiri Kosina , Andi Kleen , Linux Kernel Mailing List , the arch/x86 maintainers , Andi Kleen , Ingo Molnar , Borislav Petkov Subject: Re: [PATCH?] uprobes: change uprobe_write_opcode() to modify the page directly References: <529E2F0C.8070405@zytor.com> <20131203200147.GB19083@redhat.com> <529E3D4C.9070403@zytor.com> <20131203203826.GA24812@redhat.com> <20131203205400.GA25735@redhat.com> <20131204111125.GA26552@redhat.com> <529F51D9.7010001@zytor.com> <20131204164817.GA5271@redhat.com> <529F5E47.3040108@zytor.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/04/2013 09:15 AM, Linus Torvalds wrote: > On Wed, Dec 4, 2013 at 8:54 AM, H. Peter Anvin wrote: >> >> That is why I talk about the atomic instruction word... most (but not >> *all*) architectures have a fundamental minimum unit of instructions >> which is aligned and can be atomically written. Typically this is 1, 2, >> or 4 bytes. > > Note that it's not just about the "atomically written", it's also > about the guarantee that it's atomically *read*. > > x86 can certainly atomically write a 4-byte instruction too, it's just > that there's no guarantee - even if the instruction is aligned etc - > that the actual instruction decoding always ends up reading it that > way. It might re-read an instruction after encountering a prefix byte > etc etc. So even if it's all properly aligned, the reading side might > do something odd. > True, at least in theory, but the atomic instruction quantum on x86 is a byte. -hpa