Re: [PATCH v2] module: kallsyms: Ensure preemption in add_kallsyms() with PREEMPT_RT

From: Luis Chamberlain
Date: Thu Jul 07 2022 - 13:21:06 EST


On Thu, Jul 07, 2022 at 05:57:50PM +0100, Aaron Tomlin wrote:
> On Wed 2022-07-06 10:58 -0700, Luis Chamberlain wrote:
> > Hey Aaron, thanks again!
>
> Hi Luis,
>
> No problem :)
>
> > On Mon, Jul 04, 2022 at 05:17:53PM +0100, Aaron Tomlin wrote:
> > > To disable preemption in the context of add_kallsyms() is incorrect.
> >
> > Why, what broke? Did this used to work? Was the commit in question a
> > regression then? Clarifying all this will help a lot.
>
> Sorry for the confusion! If I understand correctly, nothing broke
> intrinsically.
>
> Rather with commit 08126db5ff73 ("module: kallsyms: Fix suspicious rcu
> usage") under PREEMPT_RT=y, by disabling preemption, I introduced an
> unbounded latency since the loop is not fixed which is generally frowned
> upon.

This is incredibly important information which should be added to the
commit log, specialy as PREEMPT_RT=y becomes a first class citizen.

> So, I would say this was a regression since earlier preemption was
> not disabled and we would dereference RCU-protected pointers explicitly
> i.e. without using the more appropriate rcu_dereference() family
> of primitives. That being said, these pointers cannot change in this
> context as explained previously.
>
> Would the above be suitable - just to confirm before I send another
> iteration?

Yes, I would send this to Linus for the rc series. Please adjust the
commit log with all this information.

BTW I think there is just one more fix pending from you right?

Luis