lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190114133839.29967-1-paul.kocialkowski@bootlin.com>
Date:   Mon, 14 Jan 2019 14:38:35 +0100
From:   Paul Kocialkowski <paul.kocialkowski@...tlin.com>
To:     linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        devel@...verdev.osuosl.org, linux-arm-kernel@...ts.infradead.org,
        linux-sunxi@...glegroups.com
Cc:     Pawel Osciak <pawel@...iak.com>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Kyungmin Park <kyungmin.park@...sung.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        Paul Kocialkowski <paul.kocialkowski@...tlin.com>,
        Randy Li <ayaka@...lik.info>,
        Hans Verkuil <hverkuil@...all.nl>,
        Ezequiel Garcia <ezequiel@...labora.com>,
        Tomasz Figa <tfiga@...omium.org>,
        Alexandre Courbot <acourbot@...omium.org>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: [PATCH RFC 0/3] media: Ensure access to dma-buf-imported reference buffers

This is a first attempt at implementing proper access to buffers
imported with dma-buf and used as reference frames for decoding
subsequent frames.

The main concern associated with this scenario was that memory could be
liberated while the buffer is not in a queued state. After careful
checking, it appears that this is not the case as the refcount is
always increased when importing the buffer. It is only decreased when
the same buffer is queued with a different dma-buf fd or when all
buffers are liberated. In the meantime (when decoding using the frame as
a reference happens), the buffer is thus guaranteed to stay alive.

However, buffers imported with dma-buf require calls to dma-buf-specific
map/unmap memops before they are accessed. This introduces the plumbing
for allowing that.

One major issue is that it cannot be done in atomic context, where
the job is marked as completed. To solve this, a new m2m operation
(job_done) is introduced which allows releasing access to the
reference buffers from the m2m worker thread.

Since this series touches the core of vb2 and m2m and may not be the
best way to implement this, it is marked as RFC.

This series is based on the series starting with:
  media: cedrus: Cleanup duplicate declarations from cedrus_dec header

Paul Kocialkowski (4):
  media: vb2: Add helpers to access unselected buffers
  media: v4l2-mem2mem: Add an optional job_done operation
  media: cedrus: Request access to reference buffers when decoding
  media: cedrus: Remove completed item from TODO list (dma-buf
    references)

 .../media/common/videobuf2/videobuf2-core.c   | 46 +++++++++++++++++++
 drivers/media/v4l2-core/v4l2-mem2mem.c        |  8 +++-
 drivers/staging/media/sunxi/cedrus/TODO       |  5 --
 drivers/staging/media/sunxi/cedrus/cedrus.c   |  1 +
 drivers/staging/media/sunxi/cedrus/cedrus.h   |  1 +
 .../staging/media/sunxi/cedrus/cedrus_dec.c   | 18 ++++++++
 .../staging/media/sunxi/cedrus/cedrus_dec.h   |  1 +
 .../staging/media/sunxi/cedrus/cedrus_mpeg2.c |  8 ++++
 include/media/v4l2-mem2mem.h                  |  4 ++
 include/media/videobuf2-core.h                | 15 ++++++
 10 files changed, 100 insertions(+), 7 deletions(-)

-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ