Repository navigation
trace: enforce mailbox size - #3558
Conversation
If we are fuzzing we can get the trace system into a state where it tries flush dma and overshoot the mailbox boundary. Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
|
For record here is log from the fuzzer |
xiulipan
left a comment
There was a problem hiding this comment.
@cujomalainey I think this PR as workaround is OK, but it seems not a correct fix.
The dma_trace_flush is used to dump trace message not sent by DMA trace buffer yet to mailbox. This PR just drop the overflow part.
@ranj063 Please help to check this issue, I think we should dump the latest logs to help our debug. I think we may have some mismatch with DMA_FLUSH_TRACE_SIZE and MAILBOX_TRACE_SIZE
|
@xiulipan I agree this probably isn't correct but it works for now. All definitions of |
|
@cujomalainey Interesting, if We may need to carefully check what the size means here, if it is byte size or word size. Could you send an issue first with steps to reproduce the issue. I think we need root cause and have a correct fix for it. |
It has some effect as it fixes the fuzzer. The system is trying to load 0x1000 bytes into a space of 0x380. The min causes the system to not trigger the sanitizer. |
Errors are always written to mailbox and after setting CONFIG_TRACEM then each message is written there. It happens in
as @xiulipan said, when |
|
I clicked the wrong button, I was going to comment that the trace and mailbox sizes probably need validated since the macros were added prior to the trace architecture we have today. |
|
@ktrzcinx the min does have enough of an effect to satisfy the fuzzer from going out of bounds. Would you accept this fix if I moved it to the dma flush size constant? |
|
@cujomalainey I see that it works, but it conceptually doesn't fit - the same thing is done twice or rather three times (size calculation based on avail, on r/w ptrs and min). I don't fully understand why we have some advance size calculation before, introduced here cb1fc87, simple min looks more convenience for me, so I would like to removed old size calculation and keep only yours version, but @ranj063 is the code author so may take voice here. |
|
@ranj063 ping any comments - I'm minded to merge this and wait for any reports of impact (if any). |
|
CI looks good so lets see what happens with different kernels and userspace. |
If we are fuzzing we can get the trace system into a state where it
tries flush dma and overshoot the mailbox boundary.
Signed-off-by: Curtis Malainey cujomalainey@chromium.org