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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 19 Feb 2020 10:11:39 +0100
From:   Hans Verkuil <hverkuil@...all.nl>
To:     Sergey Senozhatsky <senozhatsky@...omium.org>
Cc:     Hans Verkuil <hans.verkuil@...co.com>,
        Tomasz Figa <tfiga@...omium.org>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Kyungmin Park <kyungmin.park@...sung.com>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Sakari Ailus <sakari.ailus@....fi>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Pawel Osciak <posciak@...omium.org>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCHv2 05/12] videobuf2: handle
 V4L2_FLAG_MEMORY_NON_CONSISTENT flag

On 2/19/20 10:05 AM, Sergey Senozhatsky wrote:
> On (20/02/19 09:48), Hans Verkuil wrote:
> [..]
>>>  int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
>>>  {
>>>  	int ret = vb2_verify_memory_type(q, req->memory, req->type);
>>> +	bool consistent = true;
>>> +
>>> +	if (req->flags & V4L2_FLAG_MEMORY_NON_CONSISTENT)
>>> +		consistent = false;
>>
>> There is no check against allow_cache_hints: if that's 0, then
>> the V4L2_FLAG_MEMORY_NON_CONSISTENT flag should be cleared since it is
>> not supported.
> 
> The check is in set_queue_consistency()

That's the check against the functionality. I'm talking about the API level:
if !q->allow_cache_hints, then clear V4L2_FLAG_MEMORY_NON_CONSISTENT from
req->flags so that, when the ioctl returns to userspace, the application can
tell that that flag was rejected.

Regards,

	Hans

> 
> static void set_queue_consistency(struct vb2_queue *q, bool consistent_mem)
> {
> 	if (!q->allow_cache_hints)
> 		return;
> 
> 	if (consistent_mem)
> 		q->dma_attrs &= ~DMA_ATTR_NON_CONSISTENT;
> 	else
> 		q->dma_attrs |= DMA_ATTR_NON_CONSISTENT;
> }
> 
> I don't explicitly clear DMA_ATTR_NON_CONSISTENT attr for
> !->allow_cache_hints queues just in case if the driver for
> some reason sets that flag. ->allow_cache_hints is, thus,
> only for cases when user-space asks us to set or clear it.
> 
> 	-ss
> 

Powered by blists - more mailing lists