mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
fbdev: Add FBINFO_HIDE_SMEM_START flag
DRM drivers really, really, really don't want random userspace to share buffer behind it's back, bypassing the dma-buf buffer sharing machanism. For that reason we've ruthlessly rejected any IOCTL exposing the physical address of any graphics buffer. Unfortunately fbdev comes with that built-in. We could just set smem_start to 0, but that means we'd have to hand-roll our own fb_mmap implementation. For good reasons many drivers do that, but smem_start/length is still super convenient. Hence instead just stop the leak in the ioctl, to keep fb mmap working as-is. A second patch will set this flag for all drm drivers. Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Kees Cook <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: [email protected] Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
This commit is contained in:
parent
8d7fc2994f
commit
da6c7707ca
2 changed files with 11 additions and 0 deletions
|
|
@ -1117,6 +1117,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
|
|||
if (!lock_fb_info(info))
|
||||
return -ENODEV;
|
||||
fix = info->fix;
|
||||
if (info->flags & FBINFO_HIDE_SMEM_START)
|
||||
fix.smem_start = 0;
|
||||
unlock_fb_info(info);
|
||||
|
||||
ret = copy_to_user(argp, &fix, sizeof(fix)) ? -EFAULT : 0;
|
||||
|
|
@ -1327,6 +1329,8 @@ static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd,
|
|||
if (!lock_fb_info(info))
|
||||
return -ENODEV;
|
||||
fix = info->fix;
|
||||
if (info->flags & FBINFO_HIDE_SMEM_START)
|
||||
fix.smem_start = 0;
|
||||
unlock_fb_info(info);
|
||||
return do_fscreeninfo_to_user(&fix, compat_ptr(arg));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue