Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp811333imm; Thu, 6 Sep 2018 10:25:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYU7gAGkSxlxC7FU9Zb3BY+7GB7rn/TVnCM8QoV5Z8u37rO2si/9hmGC48xfTATfw72k/dE X-Received: by 2002:a63:1245:: with SMTP id 5-v6mr3853086pgs.299.1536254716917; Thu, 06 Sep 2018 10:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536254716; cv=none; d=google.com; s=arc-20160816; b=Id3mpVXwwOAVMqp6yQjuTz/cSe0XGpsWgtZqygAHXA4cy3SZzd4yCEa6Jx7k34gZ1F FdSRWumHwsJd9WaqYJIBxSpBcFjXDG9lB4991qbWkyj3u7+B/1wbgtYX8I2iQcUOcEKJ sQG8BPz7EsP01ap6iM0IAwJ4kVCaTipehr+3SwdWG2YxOEDO7bhs+bU+hWPml6w7SXQ8 O0caW8GuOXuTcD593q5Iit3IR4fONjpw+j2NUvu6ZpPGmdWB36Pu9XJmKlU6zbogbNkY Fnl67SImqWCCv25qFBNQY8Smf3iqpVaKKuS0sZkScoRt5AxyJedI02HZN3jmQ9R0huAA 9BOA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Q4H4brl9yqspoJNgPF8tXq7iAZCE0Tcu0AV6WT2C0M0=; b=WmOY2umwdJJpIv3Gk9ILBOA4ILfKkEIeoF3qzpPGrAf/99zDRQdiwGyyfD9HYzVGXy +s7Y249XauS6jE+iuJb6Zo4T5AJpsk5XjQ4hqplBjcID5JIUyNzMEgsxCswDP0CfF9xn 1EfIBRiCN0lYZjDv6ZboXlaOc1ExsyezEiS0go/C3NU9GZpCX5jvOKU9z0kro/dU3Mqt ZEoB0lX3V2gTpGsXD6Xlvz7W9TYwvPdAZHagsrVeJn8GaZtEFEVBmiuP1Mbt724EqtRT H38lMIrRsbJIr+459B/gdax4UUADsdAzciOY5DLjcboceQEaw+CHueDmJB7DM+k6/k2U CdlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NC38cBrI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65-v6si5943644pfe.49.2018.09.06.10.25.01; Thu, 06 Sep 2018 10:25:16 -0700 (PDT) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NC38cBrI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729613AbeIFV7f (ORCPT + 99 others); Thu, 6 Sep 2018 17:59:35 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:49696 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728106AbeIFV7f (ORCPT ); Thu, 6 Sep 2018 17:59:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Q4H4brl9yqspoJNgPF8tXq7iAZCE0Tcu0AV6WT2C0M0=; b=NC38cBrI1/lqpcdNxOwVE/g8Mt wA0rp/y4TGifnukeIpo8N71GuIRZAfUejxpfXW6MMq6NIJ8AXp//55aIyw6xlkXGomBP5Uj2Uw2Jh SuUzbKjwLhATIxLXBpGr5oirxFzwscQXw/Ba1zRHb8NuRA9g4cTwBWEn9nOzcXTur3kSRArgYeg5S SQB1xE//dCyvZayRqSs9R1eCv5MLlbl2URKdhgUr6IaxPFexxHqgc5OANyevyFV55kcBe7NB81hMm lIihfU/xDaK5iiIObDZcUfEQYnZOdEoufoRtqc9S5EwGW1lziwLyx0xEyua5jq3Z01uu8grQOwHfC EwCUUq0Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fxxzi-0003ia-Ks; Thu, 06 Sep 2018 17:23:03 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id EE5BD2058B2DE; Thu, 6 Sep 2018 19:23:00 +0200 (CEST) Date: Thu, 6 Sep 2018 19:23:00 +0200 From: Peter Zijlstra To: Nadav Amit Cc: Thomas Gleixner , LKML , Ingo Molnar , X86 ML , Arnd Bergmann , linux-arch , Dave Hansen , Jiri Kosina , Andy Lutomirski , Masami Hiramatsu , Kees Cook Subject: Re: [PATCH v2 0/6] x86/alternatives: text_poke() fixes Message-ID: <20180906172300.GK24082@hirez.programming.kicks-ass.net> References: <20180902173224.30606-1-namit@vmware.com> <20180905185617.GC24082@hirez.programming.kicks-ass.net> <8D3CE999-6D3A-4984-934A-634BDD8AC25A@vmware.com> <6B256AB7-0158-47DF-B2D5-4C835579F3A3@vmware.com> <20180906081300.GF24082@hirez.programming.kicks-ass.net> <20180906101641.GG24142@hirez.programming.kicks-ass.net> <6703CD9F-2D84-4449-A423-A4DC24677673@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6703CD9F-2D84-4449-A423-A4DC24677673@vmware.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 06, 2018 at 05:01:25PM +0000, Nadav Amit wrote: > I’ll give your patch a try once my server goes back online. I was (and still > am) worried that interrupts would be disabled when __set_pte_vaddr() is > called, which would make the fix more complicated. Thing is, we only need the TLB invalidate if the previous PTE was present and the new PTE is different. If we write the 'first' PTE, all is fine. The code as presented WARNs if we do __set_pte_vaddr() that needs a TLB invalidate and we have IRQs disabled. And aside from the GHES trainwreck, the patch as given boots and runs fine on my machine. And no, if there is a caller that has interrupts disabled and needs TLB invalidate, the patch still is right. Just means that caller is terminally broken and needs fixing (like GHES). There is no way x86 can do what needs done with IRQs disabled.