Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp230207imm; Thu, 30 Aug 2018 21:59:38 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ0T4T/JJPkNsUkeghCQecp1gN7cjokZO4O16AxQoH0s3Nx5eXZHz2T+rY63xgN0DM4i1Hi X-Received: by 2002:a17:902:5617:: with SMTP id h23-v6mr13490712pli.324.1535691578768; Thu, 30 Aug 2018 21:59:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535691578; cv=none; d=google.com; s=arc-20160816; b=L4J/wL3QKIvsR1YIkYDqq3EhN9JmGwJRBk0ESeVlG9NCCcu54HuB6yEgZr0FIHZ4IU 5LgsJKLZOwFBYD2jL2LRfwsRVeYwebTXfuyjlN6Ag/2Z0nLMxrTGhKl6F5i0OwtQ4W4i xfSXKLfp1yKF1GsROTGcJIek5i9ov9TKNFD04PVpuZLr05uH0yWdl5X+Bko9q5vSjPe/ S4tkLc5HMedMsv6XTI1mq80uoO1UgLmErIs/U37reiC3aAsKktFob2+5+NvbxJ9BZ+mN s4bcK/UGDbl6Wj4niG5cW+Xxt8UskC6FOqqyJS3jfmdHErFPnGz6Vceh5ZfG69sJziSi 5fQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=GE1TfhoKXZAGGatDm6E9awB/CuJPyBju3C1nOVX2o+c=; b=XF0WGGMkrx4YpOd/clmUwyeese/Cqd+wcUde5WdLl+t21cyeZrF7y+dfqwdQvShv8v R/iMGFn+Qt1OxjSW7nfue8ucl4sPM4E/jWUDJJFcpYEjGWmyrMsEV8X9uTLuV21pYQno hUUtzolp5bWwraGPLSZJInHzGh9TDjXmkpQ9Sl5zubcR8vuvRqBekONcmw7E/eYk9iE1 f+9ssuZX0wH9IbxLhOk/3BMpmdAlB5ZIU5RzWgtwJNBHho2yuaWv05pIZEca2taFdesL WxcP/XrWSJ0ljo35tEh0Quhhd+nl+JUZB7h6am/hKU1qwtdPGngdWO5mM+tx1MeYNkDg 0TPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pd7p3DLa; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s12-v6si8744746plr.120.2018.08.30.21.59.21; Thu, 30 Aug 2018 21:59:38 -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=pass header.i=@kernel.org header.s=default header.b=pd7p3DLa; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727282AbeHaIy5 (ORCPT + 99 others); Fri, 31 Aug 2018 04:54:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:36658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727211AbeHaIy5 (ORCPT ); Fri, 31 Aug 2018 04:54:57 -0400 Received: from devnote (sp183-74-193-25.msb.spmode.ne.jp [183.74.193.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA2A720661; Fri, 31 Aug 2018 04:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1535690959; bh=U0NG9maviC8qqYFqL/KUAaEuRM2wUpLC9+jP34PWwU8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pd7p3DLa9B3iUd7rG4kPKGqbMs9UvvpAmTEQvxPPhWIAgVgkjf73F8GLg0gd06VWn FkkXWp6zepC+CzzZtQM7Xxw0uaPVFdpr4lBMzSoVNnMv3j9H8S9EDoGi7EtmMba8MS dBkc1Lk+IQrJ8hyUyJZrbQGLFE5G4TODBEvCUgUY= Date: Fri, 31 Aug 2018 13:49:16 +0900 From: Masami Hiramatsu To: Masami Hiramatsu Cc: Nadav Amit , Thomas Gleixner , , Ingo Molnar , , Arnd Bergmann , , Dave Hansen , Andy Lutomirski , Kees Cook , Peter Zijlstra Subject: Re: [PATCH 0/6] x86/alternatives: text_poke() fixes Message-Id: <20180831134916.f8c409da94baa492008b188e@kernel.org> In-Reply-To: <20180831134635.35b6c2a919449adf4b63a133@kernel.org> References: <20180830173218.238900-1-namit@vmware.com> <20180831134635.35b6c2a919449adf4b63a133@kernel.org> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 31 Aug 2018 13:46:35 +0900 Masami Hiramatsu wrote: > On Thu, 30 Aug 2018 10:32:12 -0700 > Nadav Amit wrote: > > > This patch-set addresses some issues that were raised in a recent > > correspondence and might affect the security and the correctness of code > > patching. (Note that patching performance is not addressed by this > > patch-set). > > > > The main issue that the patches deal with is the fact that the fixmap > > PTEs that are used for patching are available for access from other > > cores and might be exploited. They are not even flushed from the TLB in > > remote cores, so the risk is even higher. Address this issue by > > introducing a temporary mm that is only used during patching. > > Unfortunately, due to init ordering, fixmap is still used during > > boot-time patching. Future patches can eliminate the need for it. > > > > The second issue is the missing lockdep assertion to ensure text_mutex > > is taken. It is actually not always taken, so fix the instances that > > were found not to take the lock (although they should be safe even > > without taking the lock). > > > > Finally, try to be more conservative and to map a single page, instead > > of two, when possible. This helps both security and performance. > > > > In addition, there is some cleanup of the patching code to make it more > > readable. > > OK, this series looks good to me, and tested with ftracetest, kprobe testsets. > > Reviewed-by: Masami Hiramatsu > Tested-by: Masami Hiramatsu Oh, I missed a note. To apply this series on -tip tree, we have to revert Jiri's text_mutex checker. 9222f606506c ("x86/alternatives: Lockdep-enforce text_mutex in text_poke*()") Thanks! -- Masami Hiramatsu