From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751843AbdH1C2O (ORCPT ); Sun, 27 Aug 2017 22:28:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:53072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbdH1C2N (ORCPT ); Sun, 27 Aug 2017 22:28:13 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A3BCF21A2F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org Date: Mon, 28 Aug 2017 11:28:04 +0900 From: Masami Hiramatsu To: Masami Hiramatsu Cc: Ingo Molnar , Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, Ananth N Mavinakayanahalli , Anil S Keshavamurthy , "David S . Miller" , linux-kernel@vger.kernel.org Subject: Re: [PATCH -tip v3 0/2] kprobes/x86: Another way to make insn buffer RO and cleanup Message-Id: <20170828112804.c7146d3246dfcf34a9671daf@kernel.org> In-Reply-To: <150304456422.17009.11803713159528262211.stgit@devbox> References: <150304456422.17009.11803713159528262211.stgit@devbox> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ingo, What would you think about fixing this way? This makes the instruction buffer always RO and poke it via text_poke. Thank you, On Fri, 18 Aug 2017 17:22:54 +0900 Masami Hiramatsu wrote: > Hi, > > This series modifies how to handle RO insn buffer and > cleans up addressof operators. > > The 1st patch changes the RO insn buffer handling: instead > of using set_memory_ro/rw to modify the buffer, it prepares > new instructions in another buffer and write it with > text_poke() as suggested by Ingo Molnar (Thanks!). > Since the text_poke() is safely modifying code by > mapping alias pages, it can write RO pages. > This also override alloc_insn_page() so that it returns > ROX page directly. > > The 2nd one is not changed. It is a cleanup patch > to remove addressof operators ("&") since > it is meaningless anymore. > > V3 has just a following update: > - [1/2] Not to just add set_memory_ro(), introduce new > patch to change the way to handle RO pages. > > Thanks, > > --- > > Masami Hiramatsu (2): > kprobes/x86: Make insn buffer always ROX and use text_poke > kprobes/x86: Remove addressof operators > > > arch/x86/include/asm/kprobes.h | 4 +- > arch/x86/kernel/kprobes/common.h | 6 ++- > arch/x86/kernel/kprobes/core.c | 61 +++++++++++++++++++++------------ > arch/x86/kernel/kprobes/opt.c | 71 +++++++++++++++++++++----------------- > kernel/kprobes.c | 2 + > 5 files changed, 86 insertions(+), 58 deletions(-) > > -- > Masami Hiramatsu -- Masami Hiramatsu