On Tue, 30 Jun 2026 22:00:11 +0200
Martin Kaiser <[email protected]> wrote:

> The fsl edma events store a pointer to a struct fsl_edma_engine in the
> ringbuffer and dereference it when a log entry is printed. At this time,
> the pointer may no longer be valid.

Nice catch.

> 
> Event injection can be used to trigger a crash:
> 
> $ cd /sys/kernel/tracing
> $ echo 'value = 0' > events/fsl_edma/edma_writeb/inject
> $ cat trace
> 
> The log output needs only edma->membase. Add a membase field at the end
> of the event and use the new field for log output. Keep the existing
> fields for backward compatibility.
> 

Cc: [email protected]

> Fixes: 11102d0c343b ("dmaengine: fsl-edma: add trace event support")
> Signed-off-by: Martin Kaiser <[email protected]>

Reviewed-by: Steven Rostedt <[email protected]>

> ---
>  drivers/dma/fsl-edma-trace.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/fsl-edma-trace.h b/drivers/dma/fsl-edma-trace.h
> index d3541301a247..45d964a3726d 100644
> --- a/drivers/dma/fsl-edma-trace.h
> +++ b/drivers/dma/fsl-edma-trace.h
> @@ -19,14 +19,16 @@ DECLARE_EVENT_CLASS(edma_log_io,
>               __field(struct fsl_edma_engine *, edma)
>               __field(void __iomem *, addr)
>               __field(u32, value)
> +             __field(void __iomem *, membase)
>       ),
>       TP_fast_assign(
>               __entry->edma = edma;
>               __entry->addr = addr;
>               __entry->value = value;
> +             __entry->membase = edma->membase;
>       ),
>       TP_printk("offset %08x: value %08x",
> -             (u32)(__entry->addr - __entry->edma->membase), __entry->value)
> +             (u32)(__entry->addr - __entry->membase), __entry->value)

Hmm, I think I should update the TP_printk checks at boot to cover this too.

-- Steve

>  );
>  
>  DEFINE_EVENT(edma_log_io, edma_readl,


Reply via email to