Subject: Re: [PATCH 2/3] module: Fix up module_notifier return values.

From: Mathieu Desnoyers <[email-masked]>
Date: Mon, 24 Jun 2019 13:50:56 -0400 (EDT)

----- On Jun 24, 2019, at 11:52 AM, Joel Fernandes, Google [email-masked] wrote:

> On Mon, Jun 24, 2019 at 10:01:04AM -0400, Mathieu Desnoyers wrote:
>> ----- On Jun 24, 2019, at 5:18 AM, Peter Zijlstra [email-masked] wrote:
>> 
>> > While auditing all module notifiers I noticed a whole bunch of fail
>> > wrt the return value. Notifiers have a 'special' return semantics.
>> > 
>> > Cc: Robert Richter <[email-masked]>
>> > Cc: Steven Rostedt <[email-masked]>
>> > Cc: Ingo Molnar <[email-masked]>
>> > Cc: Alexei Starovoitov <[email-masked]>
>> > Cc: Daniel Borkmann <[email-masked]>
>> > Cc: Martin KaFai Lau <[email-masked]>
>> > Cc: Song Liu <[email-masked]>
>> > Cc: Yonghong Song <[email-masked]>
>> > Cc: Mathieu Desnoyers <[email-masked]>
>> > Cc: "Paul E. McKenney" <[email-masked]>
>> > Cc: "Joel Fernandes (Google)" <[email-masked]>
>> > Cc: Ard Biesheuvel <[email-masked]>
>> > Cc: Thomas Gleixner <[email-masked]>
>> > Cc: [email-masked]
>> > Cc: [email-masked]
>> > Cc: [email-masked]
>> > Cc: [email-masked]
>> > Signed-off-by: Peter Zijlstra (Intel) <[email-masked]>
>> 
>> Thanks Peter for looking into this, especially considering your
>> endless love for kernel modules! ;)
>> 
>> It's not directly related to your changes, but I notice that
>> kernel/trace/trace_printk.c:hold_module_trace_bprintk_format()
>> appears to leak memory. Am I missing something ?
> 
> Could you elaborate? Do you mean there is no MODULE_STATE_GOING notifier
> check? If that's what you mean then I agree, there should be some place
> where the format structures are freed when the module is unloaded no?

Yes, the lack of GOING notifier is worrying considering that GOING
performs memory allocation.

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com