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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200819151656.GA106705@PWN>
Date:   Wed, 19 Aug 2020 11:16:56 -0400
From:   Peilin Ye <yepeilin.cs@...il.com>
To:     Hans Verkuil <hverkuil@...all.nl>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-media@...r.kernel.org,
        linux-kernel-mentees@...ts.linuxfoundation.org,
        syzkaller-bugs@...glegroups.com, linux-kernel@...r.kernel.org
Subject: Re: [Linux-kernel-mentees] [PATCH] v4l2-tpg: Fix
 global-out-of-bounds read in precalculate_color()

Hi Mr. Verkuil,

On Wed, Aug 19, 2020 at 04:26:28PM +0200, Hans Verkuil wrote:
> Hi Peilin,
> 
> On 10/08/2020 07:05, Peilin Ye wrote:
> > precalculate_color() is reading out of `sin` since `tpg->hue` is not being
> > properly checked. Fix it. `cos` is safe, as long as `tpg->hue` is higher
> > than or equal to -192.
> 
> Thank you for this patch, but there is something I don't understand, namely
> just *how* tpg->hue can be out-of-range.
> 
> From what I can see vivid sets hue via tpg_s_hue() when the V4L2_CID_HUE control
> is set. But that control has a range of -128...128, so ctrl->val should always be in
> that range.
> 
> I would really like to know 1) what the value of tpg->hue actually is when it goes
> out of range, and 2) who is changing it to that value. Can you do a bit more digging?

Sure, of course! I will try to figure that out first.

Thank you,
Peilin

> That said, it makes sense that precalculate_color() avoids reading out-of-bounds.
> 
> > 
> > Fixes: 63881df94d3e ("[media] vivid: add the Test Pattern Generator")
> > Reported-and-tested-by: syzbot+02d9172bf4c43104cd70@...kaller.appspotmail.com
> > Link: https://syzkaller.appspot.com/bug?id=db50123c788e2cc5a9d90de569c398b66293ee48
> > Signed-off-by: Peilin Ye <yepeilin.cs@...il.com>
> > ---
> >  drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> > index 50f1e0b28b25..52205fe096f7 100644
> > --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> > +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> > @@ -930,6 +930,9 @@ static void precalculate_color(struct tpg_data *tpg, int k)
> >  		/* Implement these operations */
> >  		int tmp_cb, tmp_cr;
> >  
> > +		if (tpg->hue < -128 || tpg->hue > 128)
> > +			return;
> 
> Rather than returning here, I prefer to just clamp tpg->hue to the valid range.
> 
> I'd be willing to merge a patch that clamps tpg->hue (it certainly doesn't hurt),
> but I also would like to understand how it can be out of range in the first place.
> I have the feeling that this is a symptom of another problem elsewhere.
> 
> Regards,
> 
> 	Hans
> 
> > +
> >  		/* First convert to YCbCr */
> >  
> >  		color_to_ycbcr(tpg, r, g, b, &y, &cb, &cr);
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ