• Daniel Vetter's avatar
    fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace · 6fd33a33
    Daniel Vetter authored
    This is an oversight from dc5bdb68 ("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.
    Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
    Acked-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
    Fixes: dc5bdb68 ("drm/fb-helper: Fix vt restore")
    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: shlomo@fastmail.com
    Cc: Michel Dänzer <michel@daenzer.net>
    Cc: Noralf Trønnes <noralf@tronnes.org>
    Cc: Thomas Zimmermann <tzimmermann@suse.de>
    Cc: Daniel Vetter <daniel.vetter@intel.com>
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Cc: Maxime Ripard <mripard@kernel.org>
    Cc: David Airlie <airlied@linux.ie>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: dri-devel@lists.freedesktop.org
    Cc: <stable@vger.kernel.org> # v5.7+
    Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Cc: Nathan Chancellor <natechancellor@gmail.com>
    Cc: Qiujun Huang <hqjagain@gmail.com>
    Cc: Peter Rosin <peda@axentia.se>
    Cc: linux-fbdev@vger.kernel.org
    Cc: Helge Deller <deller@gmx.de>
    Cc: Sam Ravnborg <sam@ravnborg.org>
    Cc: Geert Uytterhoeven <geert+renesas@glider.be>
    Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Cc: Shigeru Yoshida <syoshida@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230404193934.472457-1-daniel.vetter@ffwll.ch
    6fd33a33
fbmem.c 42.2 KB