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: <20240420181500.07b39c77f1ca086e8a5161b4@kernel.org>
Date: Sat, 20 Apr 2024 18:15:00 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Mike Rapoport <rppt@...nel.org>
Cc: Christophe Leroy <christophe.leroy@...roup.eu>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Alexandre
 Ghiti <alexghiti@...osinc.com>, Andrew Morton <akpm@...ux-foundation.org>,
 Björn Töpel <bjorn@...nel.org>, Catalin Marinas
 <catalin.marinas@....com>, "David S. Miller" <davem@...emloft.net>, Dinh
 Nguyen <dinguyen@...nel.org>, Donald Dutile <ddutile@...hat.com>, Eric
 Chanudet <echanude@...hat.com>, Heiko Carstens <hca@...ux.ibm.com>, Helge
 Deller <deller@....de>, Huacai Chen <chenhuacai@...nel.org>, Kent
 Overstreet <kent.overstreet@...ux.dev>, Luis Chamberlain
 <mcgrof@...nel.org>, Mark Rutland <mark.rutland@....com>, Michael Ellerman
 <mpe@...erman.id.au>, Nadav Amit <nadav.amit@...il.com>, Palmer Dabbelt
 <palmer@...belt.com>, Puranjay Mohan <puranjay12@...il.com>, Rick Edgecombe
 <rick.p.edgecombe@...el.com>, Russell King <linux@...linux.org.uk>, Song
 Liu <song@...nel.org>, Steven Rostedt <rostedt@...dmis.org>, Thomas
 Bogendoerfer <tsbogend@...ha.franken.de>, Thomas Gleixner
 <tglx@...utronix.de>, Will Deacon <will@...nel.org>, "bpf@...r.kernel.org"
 <bpf@...r.kernel.org>, "linux-arch@...r.kernel.org"
 <linux-arch@...r.kernel.org>, "linux-arm-kernel@...ts.infradead.org"
 <linux-arm-kernel@...ts.infradead.org>, "linux-mips@...r.kernel.org"
 <linux-mips@...r.kernel.org>, "linux-mm@...ck.org" <linux-mm@...ck.org>,
 "linux-modules@...r.kernel.org" <linux-modules@...r.kernel.org>,
 "linux-parisc@...r.kernel.org" <linux-parisc@...r.kernel.org>,
 "linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
 "linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>,
 "linux-trace-kernel@...r.kernel.org" <linux-trace-kernel@...r.kernel.org>,
 "linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
 "loongarch@...ts.linux.dev" <loongarch@...ts.linux.dev>,
 "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
 "sparclinux@...r.kernel.org" <sparclinux@...r.kernel.org>, "x86@...nel.org"
 <x86@...nel.org>
Subject: Re: [PATCH v4 14/15] kprobes: remove dependency on CONFIG_MODULES

On Sat, 20 Apr 2024 10:33:38 +0300
Mike Rapoport <rppt@...nel.org> wrote:

> On Fri, Apr 19, 2024 at 03:59:40PM +0000, Christophe Leroy wrote:
> > 
> > 
> > Le 19/04/2024 à 17:49, Mike Rapoport a écrit :
> > > Hi Masami,
> > > 
> > > On Thu, Apr 18, 2024 at 06:16:15AM +0900, Masami Hiramatsu wrote:
> > >> Hi Mike,
> > >>
> > >> On Thu, 11 Apr 2024 19:00:50 +0300
> > >> Mike Rapoport <rppt@...nel.org> wrote:
> > >>
> > >>> From: "Mike Rapoport (IBM)" <rppt@...nel.org>
> > >>>
> > >>> kprobes depended on CONFIG_MODULES because it has to allocate memory for
> > >>> code.
> > >>>
> > >>> Since code allocations are now implemented with execmem, kprobes can be
> > >>> enabled in non-modular kernels.
> > >>>
> > >>> Add #ifdef CONFIG_MODULE guards for the code dealing with kprobes inside
> > >>> modules, make CONFIG_KPROBES select CONFIG_EXECMEM and drop the
> > >>> dependency of CONFIG_KPROBES on CONFIG_MODULES.
> > >>
> > >> Thanks for this work, but this conflicts with the latest fix in v6.9-rc4.
> > >> Also, can you use IS_ENABLED(CONFIG_MODULES) instead of #ifdefs in
> > >> function body? We have enough dummy functions for that, so it should
> > >> not make a problem.
> > > 
> > > The code in check_kprobe_address_safe() that gets the module and checks for
> > > __init functions does not compile with IS_ENABLED(CONFIG_MODULES).
> > > I can pull it out to a helper or leave #ifdef in the function body,
> > > whichever you prefer.
> > 
> > As far as I can see, the only problem is MODULE_STATE_COMING.
> > Can we move 'enum module_state' out of #ifdef CONFIG_MODULES in module.h  ?
> 
> There's dereference of 'struct module' there:
>  
> 		(*probed_mod)->state != MODULE_STATE_COMING) {
> 			...
> 		}
> 
> so moving out 'enum module_state' won't be enough.

Hmm, this part should be inline functions like;

#ifdef CONFIG_MODULES
static inline bool module_is_coming(struct module *mod)
{
	return mod->state == MODULE_STATE_COMING;
}
#else
#define module_is_coming(mod) (false)
#endif

Then we don't need the enum.
Thank you,

>  
> > >   
> > >> -- 
> > >> Masami Hiramatsu
> > > 
> 
> -- 
> Sincerely yours,
> Mike.
> 


-- 
Masami Hiramatsu (Google) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ