All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()
@ 2022-08-11 14:48 ` Andrey Strachuk
  0 siblings, 0 replies; 9+ messages in thread
From: Andrey Strachuk @ 2022-08-11 14:48 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: Andrey Strachuk, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, Geert Uytterhoeven, Helge Deller, dri-devel,
	linux-kernel, ldv-project

Add virtual screen size check to drm_fb_helper_check_var() in
order to validate userspace input.

Found by Linux Verification Center (linuxtesting.org) with syzkaller.

Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
Fixes: 785b93ef8c30 ("drm/kms: move driver specific fb common code to helper functions (v2)")
---
 drivers/gpu/drm/drm_fb_helper.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 2d4cee6a10ff..5c8b211769eb 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1355,6 +1355,12 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
 	    (drm_format_info_block_height(fb->format, 0) > 1))
 		return -EINVAL;
 
+	/* verify that virtual resolution >= physical resolution */
+	if (var->xres_virtual < var->xres)
+		var->xres_virtual = var->xres;
+	if (var->yres_virtual < var->yres)
+		var->yres_virtual = var->yres;
+
 	/*
 	 * Changes struct fb_var_screeninfo are currently not pushed back
 	 * to KMS, hence fail if different settings are requested.
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()
@ 2022-08-11 14:48 ` Andrey Strachuk
  0 siblings, 0 replies; 9+ messages in thread
From: Andrey Strachuk @ 2022-08-11 14:48 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: ldv-project, Andrey Strachuk, Thomas Zimmermann, David Airlie,
	Helge Deller, linux-kernel, Geert Uytterhoeven, dri-devel

Add virtual screen size check to drm_fb_helper_check_var() in
order to validate userspace input.

Found by Linux Verification Center (linuxtesting.org) with syzkaller.

Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
Fixes: 785b93ef8c30 ("drm/kms: move driver specific fb common code to helper functions (v2)")
---
 drivers/gpu/drm/drm_fb_helper.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 2d4cee6a10ff..5c8b211769eb 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1355,6 +1355,12 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
 	    (drm_format_info_block_height(fb->format, 0) > 1))
 		return -EINVAL;
 
+	/* verify that virtual resolution >= physical resolution */
+	if (var->xres_virtual < var->xres)
+		var->xres_virtual = var->xres;
+	if (var->yres_virtual < var->yres)
+		var->yres_virtual = var->yres;
+
 	/*
 	 * Changes struct fb_var_screeninfo are currently not pushed back
 	 * to KMS, hence fail if different settings are requested.
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()
  2022-08-11 14:48 ` Andrey Strachuk
@ 2022-08-11 14:54   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2022-08-11 14:54 UTC (permalink / raw)
  To: Andrey Strachuk
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter, Helge Deller, DRI Development,
	Linux Kernel Mailing List, ldv-project

Hi Andrey,

On Thu, Aug 11, 2022 at 4:49 PM Andrey Strachuk <strochuk@ispras.ru> wrote:
> Add virtual screen size check to drm_fb_helper_check_var() in
> order to validate userspace input.
>
> Found by Linux Verification Center (linuxtesting.org) with syzkaller.
>
> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>

Thanks for the update!

> Fixes: 785b93ef8c30 ("drm/kms: move driver specific fb common code to helper functions (v2)")

I'd drop the Fixes tag completely, as the bug was present in the
intel and radeon drivers before. But probably it doesn't matter, as no one
is gonna backport this to v2.6.31 and earlier ;-)

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()
@ 2022-08-11 14:54   ` Geert Uytterhoeven
  0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2022-08-11 14:54 UTC (permalink / raw)
  To: Andrey Strachuk
  Cc: ldv-project, Thomas Zimmermann, David Airlie, Helge Deller,
	Linux Kernel Mailing List, DRI Development

Hi Andrey,

On Thu, Aug 11, 2022 at 4:49 PM Andrey Strachuk <strochuk@ispras.ru> wrote:
> Add virtual screen size check to drm_fb_helper_check_var() in
> order to validate userspace input.
>
> Found by Linux Verification Center (linuxtesting.org) with syzkaller.
>
> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>

Thanks for the update!

> Fixes: 785b93ef8c30 ("drm/kms: move driver specific fb common code to helper functions (v2)")

I'd drop the Fixes tag completely, as the bug was present in the
intel and radeon drivers before. But probably it doesn't matter, as no one
is gonna backport this to v2.6.31 and earlier ;-)

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ldv-project] [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()
  2022-08-11 14:54   ` Geert Uytterhoeven
@ 2022-08-11 20:59     ` Alexey Khoroshilov
  -1 siblings, 0 replies; 9+ messages in thread
From: Alexey Khoroshilov @ 2022-08-11 20:59 UTC (permalink / raw)
  To: Geert Uytterhoeven, Andrey Strachuk
  Cc: ldv-project, Thomas Zimmermann, David Airlie, Helge Deller,
	Maarten Lankhorst, Linux Kernel Mailing List, Maxime Ripard,
	DRI Development, Daniel Vetter

For v2 I would suggest to update description to something like this:

Make sure that virtual screen size is not less than physical screen one.

and comment to:
    /* make sure that virtual resolution >= physical resolution */

--
Alexey


On 11.08.2022 17:54, Geert Uytterhoeven wrote:
> Hi Andrey,
> 
> On Thu, Aug 11, 2022 at 4:49 PM Andrey Strachuk <strochuk@ispras.ru> wrote:
>> Add virtual screen size check to drm_fb_helper_check_var() in
>> order to validate userspace input.
>>
>> Found by Linux Verification Center (linuxtesting.org) with syzkaller.
>>
>> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
> 
> Thanks for the update!
> 
>> Fixes: 785b93ef8c30 ("drm/kms: move driver specific fb common code to helper functions (v2)")
> 
> I'd drop the Fixes tag completely, as the bug was present in the
> intel and radeon drivers before. But probably it doesn't matter, as no one
> is gonna backport this to v2.6.31 and earlier ;-)
> 
> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 
> _______________________________________________
> ldv-project mailing list
> ldv-project@linuxtesting.org
> http://linuxtesting.org/cgi-bin/mailman/listinfo/ldv-project
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ldv-project] [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()
@ 2022-08-11 20:59     ` Alexey Khoroshilov
  0 siblings, 0 replies; 9+ messages in thread
From: Alexey Khoroshilov @ 2022-08-11 20:59 UTC (permalink / raw)
  To: Geert Uytterhoeven, Andrey Strachuk
  Cc: ldv-project, David Airlie, Helge Deller,
	Linux Kernel Mailing List, DRI Development, Thomas Zimmermann

For v2 I would suggest to update description to something like this:

Make sure that virtual screen size is not less than physical screen one.

and comment to:
    /* make sure that virtual resolution >= physical resolution */

--
Alexey


On 11.08.2022 17:54, Geert Uytterhoeven wrote:
> Hi Andrey,
> 
> On Thu, Aug 11, 2022 at 4:49 PM Andrey Strachuk <strochuk@ispras.ru> wrote:
>> Add virtual screen size check to drm_fb_helper_check_var() in
>> order to validate userspace input.
>>
>> Found by Linux Verification Center (linuxtesting.org) with syzkaller.
>>
>> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
> 
> Thanks for the update!
> 
>> Fixes: 785b93ef8c30 ("drm/kms: move driver specific fb common code to helper functions (v2)")
> 
> I'd drop the Fixes tag completely, as the bug was present in the
> intel and radeon drivers before. But probably it doesn't matter, as no one
> is gonna backport this to v2.6.31 and earlier ;-)
> 
> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 
> _______________________________________________
> ldv-project mailing list
> ldv-project@linuxtesting.org
> http://linuxtesting.org/cgi-bin/mailman/listinfo/ldv-project
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ldv-project] [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()
  2022-08-11 20:59     ` Alexey Khoroshilov
@ 2022-09-06 19:54       ` Daniel Vetter
  -1 siblings, 0 replies; 9+ messages in thread
From: Daniel Vetter @ 2022-09-06 19:54 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: ldv-project, Andrey Strachuk, David Airlie, Helge Deller,
	Linux Kernel Mailing List, Geert Uytterhoeven, DRI Development,
	Thomas Zimmermann

On Thu, Aug 11, 2022 at 11:59:00PM +0300, Alexey Khoroshilov wrote:
> For v2 I would suggest to update description to something like this:
> 
> Make sure that virtual screen size is not less than physical screen one.
> 
> and comment to:
>     /* make sure that virtual resolution >= physical resolution */

Did this land somewhere? If not please resend with r-b tags and
everything.

Thanks, Daniel

> 
> --
> Alexey
> 
> 
> On 11.08.2022 17:54, Geert Uytterhoeven wrote:
> > Hi Andrey,
> > 
> > On Thu, Aug 11, 2022 at 4:49 PM Andrey Strachuk <strochuk@ispras.ru> wrote:
> >> Add virtual screen size check to drm_fb_helper_check_var() in
> >> order to validate userspace input.
> >>
> >> Found by Linux Verification Center (linuxtesting.org) with syzkaller.
> >>
> >> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
> > 
> > Thanks for the update!
> > 
> >> Fixes: 785b93ef8c30 ("drm/kms: move driver specific fb common code to helper functions (v2)")
> > 
> > I'd drop the Fixes tag completely, as the bug was present in the
> > intel and radeon drivers before. But probably it doesn't matter, as no one
> > is gonna backport this to v2.6.31 and earlier ;-)
> > 
> > Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > 
> > Gr{oetje,eeting}s,
> > 
> >                         Geert
> > 
> > --
> > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> > 
> > In personal conversations with technical people, I call myself a hacker. But
> > when I'm talking to journalists I just say "programmer" or something like that.
> >                                 -- Linus Torvalds
> > 
> > _______________________________________________
> > ldv-project mailing list
> > ldv-project@linuxtesting.org
> > http://linuxtesting.org/cgi-bin/mailman/listinfo/ldv-project
> > 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [ldv-project] [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()
@ 2022-09-06 19:54       ` Daniel Vetter
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel Vetter @ 2022-09-06 19:54 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Geert Uytterhoeven, Andrey Strachuk, ldv-project,
	Thomas Zimmermann, David Airlie, Helge Deller, Maarten Lankhorst,
	Linux Kernel Mailing List, Maxime Ripard, DRI Development,
	Daniel Vetter

On Thu, Aug 11, 2022 at 11:59:00PM +0300, Alexey Khoroshilov wrote:
> For v2 I would suggest to update description to something like this:
> 
> Make sure that virtual screen size is not less than physical screen one.
> 
> and comment to:
>     /* make sure that virtual resolution >= physical resolution */

Did this land somewhere? If not please resend with r-b tags and
everything.

Thanks, Daniel

> 
> --
> Alexey
> 
> 
> On 11.08.2022 17:54, Geert Uytterhoeven wrote:
> > Hi Andrey,
> > 
> > On Thu, Aug 11, 2022 at 4:49 PM Andrey Strachuk <strochuk@ispras.ru> wrote:
> >> Add virtual screen size check to drm_fb_helper_check_var() in
> >> order to validate userspace input.
> >>
> >> Found by Linux Verification Center (linuxtesting.org) with syzkaller.
> >>
> >> Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
> > 
> > Thanks for the update!
> > 
> >> Fixes: 785b93ef8c30 ("drm/kms: move driver specific fb common code to helper functions (v2)")
> > 
> > I'd drop the Fixes tag completely, as the bug was present in the
> > intel and radeon drivers before. But probably it doesn't matter, as no one
> > is gonna backport this to v2.6.31 and earlier ;-)
> > 
> > Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > 
> > Gr{oetje,eeting}s,
> > 
> >                         Geert
> > 
> > --
> > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> > 
> > In personal conversations with technical people, I call myself a hacker. But
> > when I'm talking to journalists I just say "programmer" or something like that.
> >                                 -- Linus Torvalds
> > 
> > _______________________________________________
> > ldv-project mailing list
> > ldv-project@linuxtesting.org
> > http://linuxtesting.org/cgi-bin/mailman/listinfo/ldv-project
> > 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var()
  2022-09-06 19:54       ` Daniel Vetter
  (?)
@ 2022-09-07 17:20       ` Alexey Khoroshilov
  -1 siblings, 0 replies; 9+ messages in thread
From: Alexey Khoroshilov @ 2022-09-07 17:20 UTC (permalink / raw)
  To: Geert Uytterhoeven, Andrey Strachuk, lvc-project,
	Thomas Zimmermann, David Airlie, Helge Deller, Maarten Lankhorst,
	Linux Kernel Mailing List, Maxime Ripard, DRI Development

On 06.09.2022 22:54, Daniel Vetter wrote:
> On Thu, Aug 11, 2022 at 11:59:00PM +0300, Alexey Khoroshilov wrote:
>> For v2 I would suggest to update description to something like this:
>>
>> Make sure that virtual screen size is not less than physical screen one.
>>
>> and comment to:
>>     /* make sure that virtual resolution >= physical resolution */
> Did this land somewhere?
As far as I can see it is not.

>  If not please resend with r-b tags and
> everything.
The final version (v3) was resent Fri, 12 Aug 2022 04:32:12 -0700:

https://www.mail-archive.com/dri-devel@lists.freedesktop.org/msg407965.html

--
Alexey

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-09-07 17:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 14:48 [PATCH v2] drm/fb-helper: add virtual screen size check to drm_fb_helper_check_var() Andrey Strachuk
2022-08-11 14:48 ` Andrey Strachuk
2022-08-11 14:54 ` Geert Uytterhoeven
2022-08-11 14:54   ` Geert Uytterhoeven
2022-08-11 20:59   ` [ldv-project] " Alexey Khoroshilov
2022-08-11 20:59     ` Alexey Khoroshilov
2022-09-06 19:54     ` Daniel Vetter
2022-09-06 19:54       ` Daniel Vetter
2022-09-07 17:20       ` Alexey Khoroshilov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.