Re: [PATCH 2/3] module: Fix up module_notifier return values.
From: Mathieu Desnoyers
Date: Mon Jun 24 2019 - 13:51:01 EST
----- On Jun 24, 2019, at 11:52 AM, Joel Fernandes, Google joel@xxxxxxxxxxxxxxxxx wrote:
> On Mon, Jun 24, 2019 at 10:01:04AM -0400, Mathieu Desnoyers wrote:
>> ----- On Jun 24, 2019, at 5:18 AM, Peter Zijlstra peterz@xxxxxxxxxxxxx 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 <rric@xxxxxxxxxx>
>> > Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
>> > Cc: Ingo Molnar <mingo@xxxxxxxxxx>
>> > Cc: Alexei Starovoitov <ast@xxxxxxxxxx>
>> > Cc: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
>> > Cc: Martin KaFai Lau <kafai@xxxxxx>
>> > Cc: Song Liu <songliubraving@xxxxxx>
>> > Cc: Yonghong Song <yhs@xxxxxx>
>> > Cc: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
>> > Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxx>
>> > Cc: "Joel Fernandes (Google)" <joel@xxxxxxxxxxxxxxxxx>
>> > Cc: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
>> > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>> > Cc: oprofile-list@xxxxxxxxxxxx
>> > Cc: linux-kernel@xxxxxxxxxxxxxxx
>> > Cc: netdev@xxxxxxxxxxxxxxx
>> > Cc: bpf@xxxxxxxxxxxxxxx
>> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
>>
>> 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