Skip to content

HEVC decode - fix a whole lot of security holes and misc issues - #7780

Open
jc-kynesim wants to merge 17 commits into
raspberrypi:rpi-6.18.yfrom
jc-kynesim:dev/6.18/hevc_d_sec_1
Open

jc-kynesim wants to merge 17 commits into
raspberrypi:rpi-6.18.yfrom
jc-kynesim:dev/6.18/hevc_d_sec_1

Conversation

@jc-kynesim

Copy link
Copy Markdown
Contributor

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 :-)

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 the 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_competion 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.
Fixe 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 just just what the user passed not the
actual size - use v2_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 corrcetly
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant