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  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]
Date:   Tue, 18 Aug 2020 14:51:41 +0300
From:   Mike Rapoport <rppt@...nel.org>
To:     Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
Cc:     Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, Andi Kleen <ak@...ux.intel.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
        Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jessica Yu <jeyu@...nel.org>, Ard Biesheuvel <ardb@...nel.org>
Subject: Re: [PATCH v5 5/6] kprobes: Use text_alloc() and text_free()

On Tue, Aug 18, 2020 at 08:30:29AM +0300, Jarkko Sakkinen wrote:
> On Sun, Jul 26, 2020 at 11:14:08AM +0300, Mike Rapoport wrote:
> > > 
> > > I'm not still sure that I fully understand this feedback as I don't see
> > > any inherent and obvious difference to the v4. In that version fallbacks
> > > are to module_alloc() and module_memfree() and text_alloc() and
> > > text_memfree() can be overridden by arch.
> > 
> > The major difference between your v4 and my suggestion is that I'm not
> > trying to impose a single ARCH_HAS_TEXT_ALLOC as an alternative to
> > MODULES but rather to use per subsystem config option, e.g.
> > HAVE_KPROBES_TEXT_ALLOC.
> > 
> > Another thing, which might be worth doing regardless of the outcome of
> > this discussion is to rename alloc_insn_pages() to text_alloc_kprobes()
> > because the former is way too generic and does not emphasize that the 
> > instruction page is actually used by kprobes only.
> 
> What if we in kernel/kprobes.c just:
> 
> #ifndef CONFIG_ARCH_HAS_TEXT_ALLOC

I don't think that CONFIG_ARCH_HAS_TEXT_ALLOC will work for all
architectures.

If an architecture has different restrictions for allocation of text
for, say, modules, kprobes, bfp, it won't be able to use a single
ARCH_HAS_TEXT_ALLOC. Which means that this architecture is stuck with
dependency of kprobes on MODULES until the next rework.

> void __weak *alloc_insn_page(void)
> {
> 	return module_alloc(PAGE_SIZE);
> }
> 
> void __weak free_insn_page(void *page)
> {
> 	module_memfree(page);
> }
> #endif
> 
> In Kconfig (as in v5):
> 
> config KPROBES
> 	bool "Kprobes"
> 	depends on MODULES || ARCH_HAS_TEXT_ALLOC
> 
> I checked architectures that override alloc_insn_page(). With the
> exception of x86, they do not call module_alloc().
> 
> If no rename was done, then with this approach a more consistent.
> config flag name would be CONFIG_ARCH_HAS_ALLOC_INSN_PAGE.
> 
> I'd call the function just as kprobes_alloc_page(). Then the
> config flag would become CONFIG_HAS_KPROBES_ALLOC_PAGE.
> 
> > -- 
> > Sincerely yours,
> > Mike.
> 
> Thanks for the feedback!
> 
> /Jarkko

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists