From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754739AbcLZEaZ (ORCPT ); Sun, 25 Dec 2016 23:30:25 -0500 Received: from mail.kernel.org ([198.145.29.136]:44286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725AbcLZEaX (ORCPT ); Sun, 25 Dec 2016 23:30:23 -0500 Date: Mon, 26 Dec 2016 13:30:12 +0900 From: Masami Hiramatsu To: Masami Hiramatsu Cc: Josh Poimboeuf , linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: Detecting kprobes generated code addresses Message-Id: <20161226133012.347f7e45dbf8a8d671ea07fb@kernel.org> In-Reply-To: <20161225151600.c43c8970ce95447e067893c1@kernel.org> References: <20161222064219.2urtfm426rv3vtqb@treble> <20161225121320.b1ee82377e744805ffe47f7f@kernel.org> <20161225151600.c43c8970ce95447e067893c1@kernel.org> X-Mailer: Sylpheed 3.5.0 (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 On Sun, 25 Dec 2016 15:16:00 +0900 Masami Hiramatsu wrote: > On Sun, 25 Dec 2016 12:13:20 +0900 > Masami Hiramatsu wrote: > > > On Thu, 22 Dec 2016 00:42:19 -0600 > > Josh Poimboeuf wrote: > > > > > Hi Masami, > > > > > > I would like to make __kernel_text_address() be able to detect whether > > > an address belongs to code which was generated by kprobes. As far as I > > > can tell, that information seems to be in the 'pages' lists of > > > kprobe_insn_slots and kprobe_optinsn_slots. But they seem to be > > > protected by mutexes. > > > > Right. It is currently under mutex because it may kick > > page allocation. But I think it is easy to fix that :) > > Hmm, IMHO, it seems that we should add a dummy (auto-generated) > symbol for optprobe trampoline code to kallsyms so that > __kernel_text_address() automatically returns true on it. Sorry, I reconsidered this idea and conclude it was overkill. As same as ftrace does, maybe it is enough to add a check routine to __kernel_text_address(). Thanks, -- Masami Hiramatsu