Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2213141imu; Thu, 10 Jan 2019 10:07:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN4Li6aRv8gubbJAyWrRrsPO3i81UOVZkPc5LwgoMdLHI9S/izUhB3feQ+vGg1feQHuIJPQK X-Received: by 2002:a62:7a8b:: with SMTP id v133mr11394791pfc.159.1547143647952; Thu, 10 Jan 2019 10:07:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547143647; cv=none; d=google.com; s=arc-20160816; b=q1zEqlYcObmH7GCK6Y8qZxZTcZqbZMSEmxGPlQcmcDTrCpbfzxLSZa+CDXT+Vm/fVa IUUclRylHesy3r82rfuGmk/y3B27IZ3DutuL5EL+VF5wFvmWQFmV+xCNLySlakyDusrA qLEGnTFKXXqnHBa9GGAEnQANESV4ntbt8Xq/gf7nMR3zErduV2MrQe5KuNRMFGYgscC4 w53yKR6rzi5lAyseCCUyx13ELSlzqqkbJaoN3esnuHLnK5xyLqtfH89893yEsnTS9V+T 51jAtqZXPSgSc/uCNpVyQd5nUMCsuPuGk7BJOxNwhv50rv8ITlBrSYNMQvxwAj1A038W S9+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=AWvR3EDGd3aa/GOpXvhynlffvzPSfC8VTtWtqXAE08w=; b=brvHxWRSyUcprk3VXI9t42hQbwtmPltdTEZjer64ccPNaHeWX+uJv/4ICVR4SQ2/iy Tv3/ePae3sdUXZwBlDySCxFmc1JhCc/Gx/yU15/9KKGef5jDVlGoj3JYm7wFb/FEr/Gb jokAMUEMA1koIcK2EFTUMQp+gzsHtNnltjwuheV2uP9Wf+Wgysbz+TC0j/kU0VYqd9dq /r8QYQW4fx5zZYN6CsegYnd43MGXSRo5o6yyw5VyCuJFnqVMfUN0US21w7A+fvEmS+1J AbYwA6IIIF5U8kEur/7RqaYCWgdmmGw4Kx4DiYSfH7WwKNeIqwpUXV+g1AN8B35rP+P/ GWGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d36si52074552pla.216.2019.01.10.10.07.12; Thu, 10 Jan 2019 10:07:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730803AbfAJSEa (ORCPT + 99 others); Thu, 10 Jan 2019 13:04:30 -0500 Received: from mga17.intel.com ([192.55.52.151]:39696 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729480AbfAJSE3 (ORCPT ); Thu, 10 Jan 2019 13:04:29 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2019 10:04:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,462,1539673200"; d="scan'208";a="113741945" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.154]) by fmsmga007.fm.intel.com with ESMTP; 10 Jan 2019 10:04:28 -0800 Date: Thu, 10 Jan 2019 10:04:28 -0800 From: Sean Christopherson To: Steven Rostedt Cc: Josh Poimboeuf , Nadav Amit , X86 ML , LKML , Ard Biesheuvel , Andy Lutomirski , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , Julia Cartwright , Jessica Yu , "H. Peter Anvin" , Rasmus Villemoes , Edward Cree , Daniel Bristot de Oliveira Subject: Re: [PATCH v3 5/6] x86/alternative: Use a single access in text_poke() where possible Message-ID: <20190110180428.GG16556@linux.intel.com> References: <279b8003f7f0a6831d090ab822d37bc958f974de.1547073843.git.jpoimboe@redhat.com> <8138A1EE-359D-4CD2-8E96-5BF00313AB3B@vmware.com> <20190110172004.wuh45xoafynfm2df@treble> <20190110123243.3b9e0856@gandalf.local.home> <20190110174257.GE16556@linux.intel.com> <20190110125757.1c8d2870@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190110125757.1c8d2870@gandalf.local.home> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 10, 2019 at 12:57:57PM -0500, Steven Rostedt wrote: > On Thu, 10 Jan 2019 09:42:57 -0800 > Sean Christopherson wrote: > > > On Thu, Jan 10, 2019 at 12:32:43PM -0500, Steven Rostedt wrote: > > > On Thu, 10 Jan 2019 11:20:04 -0600 > > > Josh Poimboeuf wrote: > > > > > > > > > > > While I can't find a reason for hypervisors to emulate this instruction, > > > > > smarter people might find ways to turn it into a security exploit. > > > > > > > > Interesting point... but I wonder if it's a realistic concern. BTW, > > > > text_poke_bp() also relies on undocumented behavior. > > > > > > But we did get an official OK from Intel that it will work. Took a bit > > > of arm twisting to get them to do so, but they did. And it really is > > > pretty robust. > > > > Did we (they?) list any caveats for this behavior? E.g. I'm fairly > > certain atomicity guarantees go out the window if WC memtype is used. > > Note, the text_poke_bp() process was this: (nothing to do with atomic > guarantees) > > add breakpoint (one byte) to instruction. > > Sync all cores (send an IPI to each one). > > change the back half of the instruction (the rest of the instruction > after the breakpoint). > > Sync all cores > > Remove the breakpoint with the new byte of the new instruction. > > > What atomicity guarantee does the above require? I was asking in the context of static calls. My understanding is that the write to change the imm32 of the CALL needs to be atomic from a code fetch perspective so that we don't jump to a junk address. Or were you saying that Intel gave an official OK on text_poke_bp()?