Re: [PATCH 05/13] clocksource/arm_arch_timer: Fix MMIO base address vs callback ordering issue

From: Marc Zyngier
Date: Tue Aug 10 2021 - 04:27:38 EST


On Mon, 09 Aug 2021 17:52:00 +0100,
Oliver Upton <oupton@xxxxxxxxxx> wrote:
>
> On Mon, Aug 9, 2021 at 8:27 AM Marc Zyngier <maz@xxxxxxxxxx> wrote:
> >
> > The MMIO timer base address gets published after we have registered
> > the callbacks and the interrupt handler, which is... a bit dangerous.
> >
> > Fix this by moving the base address publication to the point where
> > we register the timer, and expose a pointer to the timer structure
> > itself rather than a naked value.
> >
> > Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
>
> Is this patch stable-worthy? I take it there haven't been any reports
> of issues, though this seems rather perilous.

It *could* deserve a Cc stable, although I suspect it doesn't easily
fall over with the current code:

- When programming a timer, the driver uses the base contained in
struct arch_timer, and derived from the clock_event_device.
- As long as you don't need to read the counter, you are good (the
whole point of using TVAL is that you avoid reading the counter).

It is only if someone called into the standalone counter accessor that
there would be a firework, and that's rather unlikely.

Thanks,

M.

--
Without deviation from the norm, progress is not possible.