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, 8 Feb 2023 00:06:49 +0200
From:   Andy Shevchenko <andriy.shevchenko@...el.com>
To:     Ricardo Ribalda <ribalda@...omium.org>
Cc:     Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Kees Cook <keescook@...omium.org>, ionut_n2001@...oo.com,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH] media: uvcvideo: Silence memcpy() run-time false
 positive warnings

On Mon, Jan 09, 2023 at 11:46:00AM +0100, Ricardo Ribalda wrote:
> Hi Laurent
> 
> I was thinking about something on the line of the attached patch,
> 
> uvc_frame_header->data could also be replaced with a union.
> 
> Warning, not tested ;)

...

> +struct uvc_frame_header {
> +	u8 length;
> +	u8 flags;
> +	u8 data[];
> +} __packed;

__packed! (See below)

...

> +		pts = (u32 *) header->data;

Ai-ai-ai.
Here is just a yellow flag...

...

>  	uvc_dbg(stream->dev, FRAME,
>  		"%s(): t-sys %lluns, SOF %u, len %u, flags 0x%x, PTS %u, STC %u frame SOF %u\n",
>  		__func__, ktime_to_ns(time), meta->sof, meta->length,
>  		meta->flags,
> +		has_pts ? *pts : 0,

...and here is a red flag. What you need to have is

	void *pts;
	u32 pts_val;

	pts_val = get_unaligned_be32(); // or le32

	...use pts_val...

> +		has_scr ? scr->scr : 0,
> +		has_scr ? scr->frame_sof & 0x7ff : 0);


-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ