Repository navigation
HEVC decode - fix a whole lot of security holes and misc issues - #7780
Conversation
Review of #7780: HEVC decode security/misc fixesOverall this looks good. I went through all 17 commits against Correctness / design
Commit message nits
Not build-tested or run on a Pi. |
|
All of these that suggest action except (3) come down to "it would be nice to add a comment" or "fix spelling". I had a look at (3) and it is mildly annoying to add all the locks required to make it go away. On the whole I believe that if the user is changing the SPS at the same time as poking the format that depends on it then they deserve everything they get - even if fixed you have a race as to what you get. So I propose to do nothing about (3) unless you have strong feelings about it. I'll fix spelling / add a few comments for the other points. |
tile_entry_fill will not fulfil its stated guarantee to leave one slot free if its loop never runs. Fix that. Signed-off-by: John Cox <jc@kynesim.co.uk>
If there is a concurrent decode and streamoff request there is a theoretical window in which the streamoff can complete before the decode. Close it. Signed-off-by: John Cox <jc@kynesim.co.uk>
frame_slot and rpi_currpoc are used in the error path before they are set. Fix this. Signed-off-by: John Cox <jc@kynesim.co.uk>
Typo after checking if PPS has changed. Fix it Signed-off-by: John Cox <jc@kynesim.co.uk>
…e started Starting the h/w and therefore keeping decode context based only on OUTPUT streaming state allows CAPTURE formats to change without the context changing. This allows for missized buffers. Fix so the h/w is shutdown if either stream is off. Signed-off-by: John Cox <jc@kynesim.co.uk>
Remove device serialization of G_FMT and S_FMT and use the per context lock instead for these ops. Signed-off-by: John Cox <jc@kynesim.co.uk>
Add code to invalidate a capture buffer slot if the buffer is removed Also change sync to use wait_for_completion which is both neater and safer than the existing wait_queue logic Signed-off-by: John Cox <jc@kynesim.co.uk>
min_queued_buffers = 1 is unneeded and Claude asserts that it can cause a (unlikely) race such that a job can be started before _start has completed so remove it. (Hantro doesn't have this line) Signed-off-by: John Cox <jc@kynesim.co.uk>
Requests are manually completed. Fix cleanup code to complete them. Signed-off-by: John Cox <jc@kynesim.co.uk>
Take the control lock whilst h265_setup is in progress to avoid inconsistent values whilst in use. Signed-off-by: John Cox <jc@kynesim.co.uk>
Control setup errors ignored, v4l2_fh_exit missing on error path. Fix these. Signed-off-by: John Cox <jc@kynesim.co.uk>
Tighten up value checking so we cannot program wrong values into the h/w Signed-off-by: John Cox <jc@kynesim.co.uk>
Tiles must turn up in the correct order. Enforce this. Signed-off-by: John Cox <jc@kynesim.co.uk>
It is possible to remove all CAPTURE buffers whilst streaming. This allows format change as that makes it no longer busy. Check for streaming too. Signed-off-by: John Cox <jc@kynesim.co.uk>
Setup checks the vb2_v4l2_buffer plane length member which may not be correct for dmabufs as that is just what the user passed not the actual size - use vb2_plane_size on the vb2_buf instead Signed-off-by: John Cox <jc@kynesim.co.uk>
Separate unregister and device release functions so we behave correctly if unbound whilst running. Signed-off-by: John Cox <jc@kynesim.co.uk>
Pick a format that matches the SPS (if set) in hevc_d_try_fmt_vid_cap if what the user set is unsupported or bad rather than leaving bad and always fixing up to NV12MT_COL128 Signed-off-by: John Cox <jc@kynesim.co.uk>
f5d96d4 to
9255d04
Compare
|
Maybe that was what I meant to push but compare suggests a huge amount has changed when I've just fixed some comments and tweaked the removed buffer patch very slightly. Possibly because I rebased onto current rpi-6.18.y head? |
…ration It is possible to flood the log with warning messages by setting bad values in SPS, PPS etc. It is valuable to have this info when debugging so reduce the level to debug. Reported-by: Roy <rongh7426@gmail.com> Closes: raspberrypi#7796 Signed-off-by: John Cox <jc@kynesim.co.uk>
|
Also added a commit to reduce the level of debug when misconfiguring controls. Now reliant on the debug level rather than potentially flooding the log. |
I ran Mythos over hevc_d and it found quite a lot of stuff that previous Claude's hadn't found. This is the accumulated patch set. We aren't quite clean but I'm not worried by any of the remaining points it raised.
Time for Dom's Claude to argue with my Claude :-)