Re: [PATCH v8 09/13] module: Move kallsyms support into a separate file

Christophe Leroy
2022-02-25T09:27:42Z

Le 25/02/2022 à 10:15, Petr Mladek a écrit :
> On Tue 2022-02-22 14:12:59, Aaron Tomlin wrote:
>> No functional change.
>
> The patch adds rcu_dereference_sched() into several locations.
> It triggers lockdep warnings, see below.
>
> It is good example why avoid any hidden changes when shuffling
> code. The changes in the code should be done in a preparatory
> patch or not at all.
>
> This patch is even worse because these changes were not
> mentioned in the commit message. It should describe what
> is done and why.
>
> I wonder how many other changes are hidden in this patchset
> and if anyone really checked them.

That's probably my fault, when I reviewed version v5 of the series I
mentionned all checkpatch and sparse reports asking Aaron to make his
series exempt of such warnings. Most warnings where related to style
(parenthesis alignment, blank lines, spaces, etc ...) or erroneous
casting etc....

But for that particular patch we had:

kernel/module/kallsyms.c:174:23: warning: incorrect type in assignment
(different address spaces)
kernel/module/kallsyms.c:174:23: expected struct mod_kallsyms
[noderef] __rcu *kallsyms
kernel/module/kallsyms.c:174:23: got void *
kernel/module/kallsyms.c:176:12: warning: dereference of noderef expression
kernel/module/kallsyms.c:177:12: warning: dereference of noderef expression
kernel/module/kallsyms.c:179:12: warning: dereference of noderef expression
kernel/module/kallsyms.c:180:12: warning: dereference of noderef expression
kernel/module/kallsyms.c:189:18: warning: dereference of noderef expression
kernel/module/kallsyms.c:190:35: warning: dereference of noderef expression
kernel/module/kallsyms.c:191:20: warning: dereference of noderef expression
kernel/module/kallsyms.c:196:32: warning: dereference of noderef expression
kernel/module/kallsyms.c:199:45: warning: dereference of noderef expression

Aaron used rcu_dereference_sched() in order to fix that.

How should this be fixed if using rcu_dereference_sched() is not correct ?

Thanks
Christophe