Harden against other DRM masters
cover Harden against other DRM masters
From: Michel Dänzer <[email protected]>
While our VT is inactive, so we aren't DRM master, other processes can become DRM master. A DRM master can access any KMS framebuffer (FB) by guessing its handle (in practice, it should be easy to find all existing FBs by brute-forcing through a relatively small number of handles).
This series makes us destroy all FBs created by this driver before leaving our VT, except for an all-black one created especially for this purpose. This closes a long-standing potential information leak, which was made worse by reference-counting the FBs we create.
Patches 1-4 are preparatory. The meat is in patch 5. Patch 6 removes a function which is no longer used with patch 5.
Michel Dänzer (6):
Create radeon_pixmap_clear helper
Create drmmode_set_mode helper
Create radeon_pixmap_get_fb_ptr helper
Create radeon_master_screen helper
Make all active CRTCs scan out an all-black framebuffer in LeaveVT Remove drmmode_scanout_free
src/drmmode_display.c | 112 +++++++++++++++++++++++-------------------------- src/drmmode_display.h | 8 +++- src/radeon.h | 67 ++++++++++++++++------------- src/radeon_bo_helper.c | 21 ++++++++++ src/radeon_bo_helper.h | 3 ++ src/radeon_kms.c | 98 ++++++++++++++++++++++++++++++++++++++++--- 6 files changed, 214 insertions(+), 95 deletions(-)
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170828092343.27742-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
PATCH 1/6 Create radeon_pixmap_clear helper
From: Michel Dänzer <[email protected]>
Preparatory, no functional change intended yet.
--- src/drmmode_display.c | 16 +--------------- src/radeon_bo_helper.c | 21 +++++++++++++++++++++ src/radeon_bo_helper.h | 3 +++ 3 files changed, 25 insertions(+), 15 deletions(-)
src/drmmode_display.c +1 -15
@@ -2211,9 +2211,6 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height)uint32_t tiling_flags =0 , base_align;PixmapPtr ppix = screen->GetScreenPixmap (screen);void *fb_shadow; -xRectangle rect; -Bool force; -GCPtr gc;if (scrn->virtualX == width && scrn->virtualY == height)return TRUE;
@@ -2356,18 +2353,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) goto fail; } -/* Clear new buffer */ - gc =GetScratchGC (ppix->drawable.depth, scrn->pScreen); - force = info->accel_state->force; - info->accel_state->force = TRUE; -ValidateGC (&ppix->drawable, gc); - rect.x =0 ; - rect.y =0 ; - rect.width = width; - rect.height = height; - (*gc->ops->PolyFillRect)(&ppix->drawable, gc,1 , &rect); -FreeScratchGC (gc); - info->accel_state->force = force; +radeon_pixmap_clear (ppix);radeon_cs_flush_indirect (scrn);radeon_bo_wait (info->front_bo);
src/radeon_bo_helper.c +21 -0
@@ -195,6 +195,27 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int height, int depth,return bo; } +/* Clear the pixmap contents to black */ +void +radeon_pixmap_clear (PixmapPtr pixmap) +{ +ScreenPtr screen = pixmap->drawable.pScreen; +RADEONInfoPtr info =RADEONPTR (xf86ScreenToScrn (screen)); +GCPtr gc =GetScratchGC (pixmap->drawable.depth, screen); +Bool force = info->accel_state->force; +xRectangle rect; + + info->accel_state->force = TRUE; +ValidateGC (&pixmap->drawable, gc); + rect.x =0 ; + rect.y =0 ; + rect.width = pixmap->drawable.width; + rect.height = pixmap->drawable.height; + gc->ops->PolyFillRect (&pixmap->drawable, gc,1 , &rect); +FreeScratchGC (gc); + info->accel_state->force = force; +} +/* Get GEM handle for the pixmap */ Bool radeon_get_pixmap_handle (PixmapPtr pixmap,uint32_t *handle) {
src/radeon_bo_helper.h +3 -0
@@ -28,6 +28,9 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int height, int depth, int usage_hint, int bitsPerPixel, int *new_pitch, struct radeon_surface *new_surface, uint32_t *new_tiling); +extern void +radeon_pixmap_clear (PixmapPtr pixmap); +extern uint32_t radeon_get_pixmap_tiling_flags (PixmapPtr pPix);
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/6 Create drmmode_set_mode helper
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Preparatory, no functional change intended yet.
--- src/drmmode_display.c | 82 ++++++++++++++++++++++++++++++--------------------- src/drmmode_display.h | 3 ++ 2 files changed, 52 insertions(+), 33 deletions(-)
src/drmmode_display.c +49 -33
@@ -860,6 +860,52 @@ drmmode_crtc_gamma_do_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green, blue); } +Bool +drmmode_set_mode (xf86CrtcPtr crtc,struct drmmode_fb *fb,DisplayModePtr mode, +int x,int y) +{ +ScrnInfoPtr scrn = crtc->scrn; +RADEONEntPtr pRADEONEnt =RADEONEntPriv (scrn); +xf86CrtcConfigPtr xf86_config =XF86_CRTC_CONFIG_PTR (scrn); +drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; +uint32_t *output_ids =calloc (sizeof (uint32_t ), xf86_config->num_output); +int output_count =0 ; +drmModeModeInfo kmode; +Bool ret; +int i; + +if (!output_ids) +return FALSE; + +for (i =0 ; i < xf86_config->num_output; i++) { +xf86OutputPtr output = xf86_config->output[i]; +drmmode_output_private_ptr drmmode_output = output->driver_private; + +if (output->crtc != crtc) +continue ; + + output_ids[output_count] = drmmode_output->mode_output->connector_id; + output_count++; + } + +drmmode_ConvertToKMode (scrn, &kmode, mode); + + ret =drmModeSetCrtc (pRADEONEnt->fd, + drmmode_crtc->mode_crtc->crtc_id, + fb->handle, x, y, output_ids, + output_count, &kmode) ==0 ; + +if (ret) { +drmmode_fb_reference (pRADEONEnt->fd, &drmmode_crtc->fb, fb); + }else { +xf86DrvMsg (scrn->scrnIndex,X_ERROR , +"failed to set mode: %s\n" ,strerror (errno)); + } + +free (output_ids); +return ret; +} +static Bool drmmode_set_mode_major (xf86CrtcPtr crtc,DisplayModePtr mode,Rotation rotation,int x,int y)
@@ -875,12 +921,9 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,int saved_x, saved_y;Rotation saved_rotation;DisplayModeRec saved_mode; -uint32_t *output_ids =NULL ; -int output_count =0 ;Bool ret = FALSE;int i;struct drmmode_fb *fb =NULL ; -drmModeModeInfo kmode;/* The root window contents may be undefined before the WindowExposures * hook is called for it, so bail if we get here before that
@@ -899,22 +942,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, crtc->y = y; crtc->rotation = rotation; - output_ids =calloc (sizeof (uint32_t ), xf86_config->num_output); -if (!output_ids) - goto done; - -for (i =0 ; i < xf86_config->num_output; i++) { -xf86OutputPtr output = xf86_config->output[i]; -drmmode_output_private_ptr drmmode_output; - -if (output->crtc != crtc) -continue ; - - drmmode_output = output->driver_private; - output_ids[output_count] = drmmode_output->mode_output->connector_id; - output_count++; - } -if (!drmmode_handle_transform (crtc)) goto done;
@@ -925,8 +952,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,drmmode_crtc_gamma_do_set (crtc, crtc->gamma_red, crtc->gamma_green, crtc->gamma_blue, crtc->gamma_size); -drmmode_ConvertToKMode (crtc->scrn, &kmode, mode); -#ifdef RADEON_PIXMAP_SHARING if (drmmode_crtc->prime_scanout_pixmap) { drmmode_crtc_prime_scanout_update(crtc, mode, scanout_id,
@@ -967,17 +992,10 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,drmmode_crtc_wait_pending_event (drmmode_crtc, pRADEONEnt->fd, drmmode_crtc->flip_pending); -if (drmModeSetCrtc (pRADEONEnt->fd, - drmmode_crtc->mode_crtc->crtc_id, - fb->handle, x, y, output_ids, - output_count, &kmode) !=0 ) { -xf86DrvMsg (crtc->scrn->scrnIndex,X_ERROR , -"failed to set mode: %s\n" ,strerror (errno)); +if (!drmmode_set_mode (crtc, fb, mode, x, y)) goto done; - }else { - ret = TRUE; -drmmode_fb_reference (pRADEONEnt->fd, &drmmode_crtc->fb, fb); - } + + ret = TRUE;if (pScreen)xf86CrtcSetScreenSubpixelOrder (pScreen);
@@ -1032,8 +1050,6 @@ done: } } -free (output_ids); -return ret; }
src/drmmode_display.h +3 -0
@@ -220,6 +220,9 @@ extern void drmmode_scanout_free(ScrnInfoPtr scrn);extern void drmmode_uevent_init (ScrnInfoPtr scrn,drmmode_ptr drmmode);extern void drmmode_uevent_fini (ScrnInfoPtr scrn,drmmode_ptr drmmode); +Bool drmmode_set_mode (xf86CrtcPtr crtc,struct drmmode_fb *fb, +DisplayModePtr mode,int x,int y); +extern int drmmode_get_crtc_id (xf86CrtcPtr crtc);extern int drmmode_get_height_align (ScrnInfoPtr scrn,uint32_t tiling);extern int drmmode_get_pitch_align (ScrnInfoPtr scrn,int bpe,uint32_t tiling);
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/6 Create radeon_pixmap_get_fb_ptr helper
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Preparatory, no functional change intended yet.
Also inline radeon_pixmap_create_fb into radeon_pixmap_get_fb, since there's only one call-site anymore.
--- src/radeon.h | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-)
src/radeon.h +29 -24
@@ -842,24 +842,10 @@ radeon_fb_create(int drm_fd, uint32_t width, uint32_t height, uint8_t depth,return NULL ; } -static inline struct drmmode_fb * -radeon_pixmap_create_fb (int drm_fd,PixmapPtr pix) -{ -uint32_t handle; - -if (!radeon_get_pixmap_handle (pix, &handle)) -return NULL ; - -return radeon_fb_create (drm_fd, pix->drawable.width, pix->drawable.height, - pix->drawable.depth, pix->drawable.bitsPerPixel, - pix->devKind, handle); -} - -static inline struct drmmode_fb * -radeon_pixmap_get_fb (PixmapPtr pix) +static inline struct drmmode_fb ** +radeon_pixmap_get_fb_ptr (PixmapPtr pix) {ScrnInfoPtr scrn =xf86ScreenToScrn (pix->drawable.pScreen); -RADEONEntPtr pRADEONEnt =RADEONEntPriv (scrn);RADEONInfoPtr info =RADEONPTR (scrn);#ifdef USE_GLAMOR
@@ -869,10 +855,7 @@ radeon_pixmap_get_fb(PixmapPtr pix)if (!priv)return NULL ; -if (!priv->fb) - priv->fb =radeon_pixmap_create_fb (pRADEONEnt->fd, pix); - -return priv->fb; +return &priv->fb; } else#endif if (info->accelOn)
@@ -883,15 +866,37 @@ radeon_pixmap_get_fb(PixmapPtr pix)if (!driver_priv)return NULL ; -if (!driver_priv->fb) - driver_priv->fb =radeon_pixmap_create_fb (pRADEONEnt->fd, pix); - -return driver_priv->fb; +return &driver_priv->fb; }return NULL ; } +static inline struct drmmode_fb * +radeon_pixmap_get_fb (PixmapPtr pix) +{ +struct drmmode_fb **fb_ptr =radeon_pixmap_get_fb_ptr (pix); + +if (!fb_ptr) +return NULL ; + +if (!*fb_ptr) { +uint32_t handle; + +if (radeon_get_pixmap_handle (pix, &handle)) { +ScrnInfoPtr scrn =xf86ScreenToScrn (pix->drawable.pScreen); +RADEONEntPtr pRADEONEnt =RADEONEntPriv (scrn); + + *fb_ptr =radeon_fb_create (pRADEONEnt->fd, pix->drawable.width, + pix->drawable.height, pix->drawable.depth, + pix->drawable.bitsPerPixel, pix->devKind, + handle); + } + } + +return *fb_ptr; +} +#define CP_PACKET0 (reg, n) \ (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))#define CP_PACKET1 (reg0, reg1) \
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/6 Create radeon_master_screen helper
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Preparatory, no functional change intended yet.
--- src/radeon.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
src/radeon.h +10 -4
@@ -185,6 +185,15 @@ typedef enum {#define radeon_is_gpu_screen (screen) (screen)->isGPU#define radeon_is_gpu_scrn (scrn) (scrn)->is_gpu +static inline ScreenPtr +radeon_master_screen (ScreenPtr screen) +{ +if (screen->current_master) +return screen->current_master; + +return screen; +} +static inline ScreenPtr radeon_dirty_master (PixmapDirtyUpdatePtr dirty) {
@@ -194,10 +203,7 @@ radeon_dirty_master(PixmapDirtyUpdatePtr dirty)ScreenPtr screen = dirty->src->drawable.pScreen;#endif -if (screen->current_master) -return screen->current_master; - -return screen; +return radeon_master_screen (screen); } static inline Bool
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/6 Make all active CRTCs scan out an all-black framebuffer in LeaveVT
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
And destroy all other FBs. This is so that other DRM masters can only get access to this all-black FB, not to any other FB we created, while we're switched away and not DRM master.
framebuffer lifetimes")
--- src/drmmode_display.c | 4 +-- src/drmmode_display.h | 4 +++ src/radeon_kms.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 98 insertions(+), 8 deletions(-)
src/drmmode_display.c +2 -2
@@ -536,7 +536,7 @@ drmmode_crtc_scanout_destroy(drmmode_ptr drmmode, } } -static void +void drmmode_crtc_scanout_free (drmmode_crtc_private_ptr drmmode_crtc) { drmmode_crtc_scanout_destroy(drmmode_crtc->drmmode,
@@ -558,7 +558,7 @@ drmmode_scanout_free(ScrnInfoPtr scrn)drmmode_crtc_scanout_free (xf86_config->crtc[c]->driver_private); } -static PixmapPtr +PixmapPtr drmmode_crtc_scanout_create (xf86CrtcPtr crtc,struct drmmode_scanout *scanout,int width,int height) {
src/drmmode_display.h +4 -0
@@ -216,6 +216,10 @@ extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);extern void drmmode_crtc_scanout_destroy (drmmode_ptr drmmode,struct drmmode_scanout *scanout);extern void drmmode_scanout_free (ScrnInfoPtr scrn); +void drmmode_crtc_scanout_free (drmmode_crtc_private_ptr drmmode_crtc); +PixmapPtr drmmode_crtc_scanout_create (xf86CrtcPtr crtc, +struct drmmode_scanout *scanout, +int width,int height);extern void drmmode_uevent_init (ScrnInfoPtr scrn,drmmode_ptr drmmode);extern void drmmode_uevent_fini (ScrnInfoPtr scrn,drmmode_ptr drmmode);
src/radeon_kms.c +92 -6
128 lines not on this page · raw message
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170828092343.27742-6-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Re: [PATCH xf86-video-ati 5/6] Make all active CRTCs scan out an all-black framebuffer in LeaveVT
Hi Michel,
Quoted 6 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
And destroy all other FBs. This is so that other DRM masters can only get access to this all-black FB, not to any other FB we created, while we're switched away and not DRM master.
Isn't the issue applicable overall - be that in X, wayland compositors, other?
IIRC the vmwgfx's kernel driver, which has extra locking [1] in order to address that.
Would a similar approach like that be applicable for radeon/amdgpu?
I'm not saying that this is bad/not needed. Just wondering on a "perfect" long term solution.
That is, unless I've lost the plot and the two are completely unrelated.
Thanks
Emil
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c?h=v4.13-rc7#n1054
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CACvgo52+5yVkKdwDMSdGnbM2C-Z-wUt3NdewP8oystW6=LVn2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH xf86-video-ati 5/6] Make all active CRTCs scan out an all-black framebuffer in LeaveVT
Quoted 8 lines · Emil Velikov
Quoted 6 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
And destroy all other FBs. This is so that other DRM masters can only get access to this all-black FB, not to any other FB we created, while we're switched away and not DRM master.
Isn't the issue applicable overall - be that in X, wayland compositors, other?
Potentially.
Quoted 3 lines
IIRC the vmwgfx's kernel driver, which has extra locking [1] in order to address that.
Would a similar approach like that be applicable for radeon/amdgpu?
I don't see how that's related.
The issue is that if the caller of DRM_IOCTL_MODE_GETFB is DRM master (or root, or using a DRM control device node), the ioctl returns a valid GEM handle for the framebuffer, so the caller can use the underlying buffer arbitrarily. This is handled by core DRM code, there's nothing kernel drivers can do about it.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 8d6d0c04-7994-3b7a-6db6-cac8d8be3a4c-otUistvHUpPR7s880joybQ@public.gmane.org
Re: [PATCH xf86-video-ati 5/6] Make all active CRTCs scan out an all-black framebuffer in LeaveVT
Quoted 4 lines · Michel Dänzer
Quoted 3 lines · Emil Velikov
Quoted 2 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
And destroy all other FBs. This is so that other DRM masters can only get access to this all-black FB, not to any other FB we created, while we're switched away and not DRM master.
Isn't the issue applicable overall - be that in X, wayland compositors, other?
Potentially.
Ack, ty.
Quoted 5 lines
Quoted 4 lines
IIRC the vmwgfx's kernel driver, which has extra locking [1] in order to address that.
Would a similar approach like that be applicable for radeon/amdgpu?
Quoted 8 lines
I don't see how that's related.
The issue is that if the caller of
DRM_IOCTL_MODE_GETFBis DRM master (or root, or using a DRM control device node), the ioctl returns a valid GEM handle for the framebuffer, so the caller can use the underlying buffer arbitrarily. This is handled by core DRM code, there's nothing kernel drivers can do about it.
Disclaimer: I'm might be a mile off.
vmgfx's vmw_master_check() which does the usual DRM master/control or root checking.
There is a "Check if we were previously master, but now dropped" which seems, perhaps too vaguely, related to what's happening here.
Admittedly I've not looked too closely at the locked_master and associated ttm code (ttm_read_lock, etc).
But was under the impression that it is used to restrict access to the [contents behind the] GEM handle, when DRM master is dropped.
That said, I'm silly - vmwgfx specifics in a radeon/ati thread is not the right thing.
Thanks
Emil
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CACvgo51bzkmjadyRqH+7quMt6VOW=tp24h3Gv3iDNdEhKDN1nQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH xf86-video-ati 5/6] Make all active CRTCs scan out an all-black framebuffer in LeaveVT
Quoted 22 lines · Emil Velikov
Quoted 6 lines · Michel Dänzer
Quoted 3 lines · Emil Velikov
IIRC the vmwgfx's kernel driver, which has extra locking [1] in order to address that.
Would a similar approach like that be applicable for radeon/amdgpu?Quoted 8 lines
I don't see how that's related.
The issue is that if the caller of
DRM_IOCTL_MODE_GETFBis DRM master (or root, or using a DRM control device node), the ioctl returns a valid GEM handle for the framebuffer, so the caller can use the underlying buffer arbitrarily. This is handled by core DRM code, there's nothing kernel drivers can do about it.Disclaimer: I'm might be a mile off.
vmgfx's
vmw_master_check()which does the usual DRM master/control or root checking.
There is a "Check if we were previously master, but now dropped" which seems, perhaps too vaguely, related to what's happening here.
Quoted 4 lines
Admittedly I've not looked too closely at the
locked_masterand associated ttm code (ttm_read_lock, etc).
But was under the impression that it is used to restrict access to the [contents behind the] GEM handle, when DRM master is dropped.
I'm not familiar with that code either, so I may be wrong, but AFAICT it's kind of the opposite, allowing userspace which was previously DRM master to do some things it otherwise wouldn't be allowed to do.
Whereas this change is about something userspace can do while it's DRM master, and which cannot be disallowed per se without breaking userspace (e.g. smooth bootsplash -> login screen -> user session transitions).
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/6 Remove drmmode_scanout_free
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
Not used anymore.
--- src/drmmode_display.c | 10 ---------- src/drmmode_display.h | 1 - 2 files changed, 11 deletions(-)
src/drmmode_display.c +0 -10
@@ -548,16 +548,6 @@ drmmode_crtc_scanout_free(drmmode_crtc_private_ptr drmmode_crtc)DamageDestroy (drmmode_crtc->scanout_damage); } -void -drmmode_scanout_free (ScrnInfoPtr scrn) -{ -xf86CrtcConfigPtr xf86_config =XF86_CRTC_CONFIG_PTR (scrn); -int c; - -for (c =0 ; c < xf86_config->num_crtc; c++) -drmmode_crtc_scanout_free (xf86_config->crtc[c]->driver_private); -} -PixmapPtr drmmode_crtc_scanout_create (xf86CrtcPtr crtc,struct drmmode_scanout *scanout,int width,int height)
src/drmmode_display.h +0 -1
@@ -215,7 +215,6 @@ extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);extern void drmmode_crtc_scanout_destroy (drmmode_ptr drmmode,struct drmmode_scanout *scanout); -extern void drmmode_scanout_free (ScrnInfoPtr scrn);void drmmode_crtc_scanout_free (drmmode_crtc_private_ptr drmmode_crtc); PixmapPtr drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout,
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Deucher, Alexander
Reviewed-by Alex DeucherQuoted 15 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Monday, August 28, 2017 5:24 AM
To: [email protected]
Subject: [PATCH xf86-video-ati 0/6] Harden against other DRM mastersFrom: Michel Dänzer <[email protected]>
While our VT is inactive, so we aren't DRM master, other processes can become DRM master. A DRM master can access any KMS framebuffer (FB) by
guessing its handle (in practice, it should be easy to find all existing FBs by brute-forcing through a relatively small number of handles).
Quoted 7 lines
This series makes us destroy all FBs created by this driver before leaving our VT, except for an all-black one created especially for this purpose. This closes a long-standing potential information leak, which was made worse by reference-counting the FBs we create.
Patches 1-4 are preparatory. The meat is in patch 5. Patch 6 removes a function which is no longer used with patch 5.
Series is:
Quoted 19 lines
Michel Dänzer (6):
Createradeon_pixmap_clearhelper
Createdrmmode_set_modehelper
Createradeon_pixmap_get_fb_ptrhelper
Createradeon_master_screenhelper
Make all active CRTCs scan out an all-black framebuffer in LeaveVT Removedrmmode_scanout_freesrc/drmmode_display.c | 112 +++++++++++++++++++++++------------------- ------- src/drmmode_display.h | 8 +++- src/radeon.h | 67 ++++++++++++++++------------- src/radeon_bo_helper.c | 21 ++++++++++ src/radeon_bo_helper.h | 3 ++ src/radeon_kms.c | 98 ++++++++++++++++++++++++++++++++++++++++--- 6 files changed, 214 insertions(+), 95 deletions(-)
Quoted 7 lines
--
2.14.1_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx