lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200714204503.833eceb606a37f4bb93d95bd@kernel.org>
Date:   Tue, 14 Jul 2020 20:45:03 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
        Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
        "David S. Miller" <davem@...emloft.net>,
        Steven Rostedt <rostedt@...dmis.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
        Will Deacon <will@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Arnd Bergmann <arnd@...db.de>, Alexandre Ghiti <alex@...ti.fr>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Sami Tolvanen <samitolvanen@...gle.com>,
        Peter Collingbourne <pcc@...gle.com>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Frederic Weisbecker <frederic@...nel.org>,
        Stephen Boyd <sboyd@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Mike Rapoport <rppt@...ux.ibm.com>,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        Jiri Olsa <jolsa@...hat.com>, hch@....de
Subject: Re: [PATCH RFC] kprobes: Remove MODULES dependency

On Mon, 13 Jul 2020 08:49:55 +0300
Jarkko Sakkinen <jarkko.sakkinen@...ux.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@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ