public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	"Naveen N. Rao" <naveen.n.rao@linux.ibm.com>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	Will Deacon <will@kernel.org>, Kees Cook <keescook@chromium.org>,
	Arnd Bergmann <arnd@arndb.de>, Alexandre Ghiti <alex@ghiti.fr>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Sami Tolvanen <samitolvanen@google.com>,
	Peter Collingbourne <pcc@google.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Sean Christopherson <sean.j.christopherson@intel.com>,
	Jiri Olsa <jolsa@redhat.com>,
	hch@lst.de
Subject: Re: [PATCH RFC] kprobes: Remove MODULES dependency
Date: Tue, 14 Jul 2020 20:45:03 +0900	[thread overview]
Message-ID: <20200714204503.833eceb606a37f4bb93d95bd@kernel.org> (raw)
In-Reply-To: <20200713054955.GC956284@linux.intel.com>

On Mon, 13 Jul 2020 08:49:55 +0300
Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote:

> On Fri, Jul 10, 2020 at 01:32:38PM +0200, Peter Zijlstra wrote:
> > On Fri, Jul 10, 2020 at 07:32:57PM +0900, Masami Hiramatsu wrote:
> > > > -	page = module_alloc(PAGE_SIZE);
> > > > +	page = vmalloc(PAGE_SIZE);
> > > 
> > > No, you can not use vmalloc here. The reason why we use module_alloc()
> > > is to allocate the executable memory for trampoline code.
> > > So, you need to use vmalloc_exec() instead.
> > 
> > vmalloc_exec() would be broken too, also hch recently got rid of that
> > thing.
> > 
> > module_alloc() really is the only sane choice here.
> > 
> > We should make module_alloc() unconditionally available, and maybe even
> > rename it to text_alloc().
> 
> Thanks for the remarks.
> 
> The current module_alloc looks like this:
> 
> void * __weak module_alloc(unsigned long size)
> {
> 	return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END,
> 			GFP_KERNEL, PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS,
> 			NUMA_NO_NODE, __builtin_return_address(0));
> }
> 
> What if I create inline functions for text_alloc() and text_memfree() and
> convert this function as:
> 
> void * __weak module_alloc(unsigned long size)
> {
> 	return text_alloc(size);
> }

Yeah, that'll be good.

Thank you,


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2020-07-14 11:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 23:45 [PATCH RFC] kprobes: Remove MODULES dependency Jarkko Sakkinen
2020-07-10  9:03 ` Peter Zijlstra
2020-07-10 10:36   ` Jarkko Sakkinen
2020-07-10 10:49     ` Peter Zijlstra
2020-07-13  5:05       ` Jarkko Sakkinen
2020-07-13 10:17         ` Peter Zijlstra
2020-07-14 11:52         ` Masami Hiramatsu
2020-07-10 10:32 ` Masami Hiramatsu
2020-07-10 11:32   ` Peter Zijlstra
2020-07-10 13:04     ` Christoph Hellwig
2020-07-13  5:52       ` Jarkko Sakkinen
2020-07-10 13:18     ` Masami Hiramatsu
2020-07-10 13:22       ` Steven Rostedt
2020-07-13  5:55         ` Jarkko Sakkinen
2020-07-13  5:49     ` Jarkko Sakkinen
2020-07-14 11:45       ` Masami Hiramatsu [this message]
2020-07-10 15:51   ` Kees Cook
2020-07-13  5:56     ` Jarkko Sakkinen
2020-07-13  5:39   ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200714204503.833eceb606a37f4bb93d95bd@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=arnd@arndb.de \
    --cc=ast@kernel.org \
    --cc=bp@alien8.de \
    --cc=davem@davemloft.net \
    --cc=frederic@kernel.org \
    --cc=hch@lst.de \
    --cc=hpa@zytor.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=keescook@chromium.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mingo@redhat.com \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=pcc@google.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=rppt@linux.ibm.com \
    --cc=samitolvanen@google.com \
    --cc=sboyd@kernel.org \
    --cc=sean.j.christopherson@intel.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox