From: Daniel Vetter <daniel@ffwll.ch>
To: Javier Martinez Canillas <javierm@redhat.com>
Cc: linux-fbdev@vger.kernel.org,
"Shigeru Yoshida" <syoshida@redhat.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
dri-devel@lists.freedesktop.org,
"Daniel Vetter" <daniel.vetter@intel.com>,
"Sam Ravnborg" <sam@ravnborg.org>, "Helge Deller" <deller@gmx.de>,
"Tetsuo Handa" <penguin-kernel@i-love.sakura.ne.jp>,
"Geert Uytterhoeven" <geert@linux-m68k.org>,
"Samuel Thibault" <samuel.thibault@ens-lyon.org>,
"Michel Dänzer" <michel@daenzer.net>,
"Bartlomiej Zolnierkiewicz" <b.zolnierkie@samsung.com>,
"Intel Graphics Development" <intel-gfx@lists.freedesktop.org>,
shlomo@fastmail.com,
"Nathan Chancellor" <natechancellor@gmail.com>,
stable@vger.kernel.org, "Noralf Trønnes" <noralf@tronnes.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Peter Rosin" <peda@axentia.se>,
"Qiujun Huang" <hqjagain@gmail.com>
Subject: Re: [Intel-gfx] [PATCH] fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace
Date: Tue, 11 Apr 2023 16:25:24 +0200 [thread overview]
Message-ID: <ZDVt1Koi39w7aQE8@phenom.ffwll.local> (raw)
In-Reply-To: <874jpmtt1v.fsf@minerva.mail-host-address-is-not-set>
On Tue, Apr 11, 2023 at 04:03:24PM +0200, Javier Martinez Canillas wrote:
> Daniel Vetter <daniel.vetter@ffwll.ch> writes:
>
> > This is an oversight from dc5bdb68b5b3 ("drm/fb-helper: Fix vt
> > restore") - I failed to realize that nasty userspace could set this.
> >
> > It's not pretty to mix up kernel-internal and userspace uapi flags
> > like this, but since the entire fb_var_screeninfo structure is uapi
> > we'd need to either add a new parameter to the ->fb_set_par callback
> > and fb_set_par() function, which has a _lot_ of users. Or some other
> > fairly ugly side-channel int fb_info. Neither is a pretty prospect.
> >
> > Instead just correct the issue at hand by filtering out this
> > kernel-internal flag in the ioctl handling code.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Fixes: dc5bdb68b5b3 ("drm/fb-helper: Fix vt restore")
>
> [..]
>
> > diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> > index 875541ff185b..3fd95a79e4c3 100644
> > --- a/drivers/video/fbdev/core/fbmem.c
> > +++ b/drivers/video/fbdev/core/fbmem.c
> > @@ -1116,6 +1116,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
> > case FBIOPUT_VSCREENINFO:
> > if (copy_from_user(&var, argp, sizeof(var)))
> > return -EFAULT;
> > + /* only for kernel-internal use */
> > + var.activate &= ~FB_ACTIVATE_KD_TEXT;
> > console_lock();
>
> I don't have a better idea on how to fix this and as you said the whole
> struct fb_var_screeninfo is an uAPI anyways...
>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Thanks for taking a look, merged to drm-misc-fixes.
>
> --
> Best regards,
>
> Javier Martinez Canillas
> Core Platforms
> Red Hat
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
prev parent reply other threads:[~2023-04-11 14:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 19:39 [Intel-gfx] [PATCH] fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace Daniel Vetter
2023-04-04 22:10 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2023-04-04 22:25 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-04-05 7:29 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-04-11 13:44 ` [Intel-gfx] [PATCH] " Daniel Vetter
2023-04-11 13:58 ` Maarten Lankhorst
2023-04-11 15:57 ` Geert Uytterhoeven
2023-04-11 14:03 ` Javier Martinez Canillas
2023-04-11 14:25 ` Daniel Vetter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZDVt1Koi39w7aQE8@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=b.zolnierkie@samsung.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=hqjagain@gmail.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=michel@daenzer.net \
--cc=natechancellor@gmail.com \
--cc=noralf@tronnes.org \
--cc=peda@axentia.se \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=sam@ravnborg.org \
--cc=samuel.thibault@ens-lyon.org \
--cc=shlomo@fastmail.com \
--cc=stable@vger.kernel.org \
--cc=syoshida@redhat.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox