All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-amdgpu] Set correct DRM event context version
@ 2017-04-10  8:37 Michel Dänzer
       [not found] ` <20170410083751.19692-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Michel Dänzer @ 2017-04-10  8:37 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Daniel Stone <daniels@collabora.com>

DRM_EVENT_CONTEXT_VERSION is the latest context version supported by
whatever version of libdrm is present. We were blindly asserting we
supported whatever version that may be, even if we actually didn't.

With libdrm 2.4.78, setting a higher context version than 2 will attempt
to call the page_flip_handler2 vfunc if it was non-NULL, which being a
random chunk of stack memory, it might well have been.

Set the version as 2, which should be bumped only with the appropriate
version checks.

Signed-off-by: Daniel Stone <daniels@collabora.com>
(Ported from xserver commit 0c8e6ed85810e96d84173a52d628863802a78d82)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2cdea90ad..f58d28f1a 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2362,7 +2362,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 
 	xf86InitialConfiguration(pScrn, TRUE);
 
-	drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
+	drmmode->event_context.version = 2;
 	drmmode->event_context.vblank_handler = amdgpu_drm_queue_handler;
 	drmmode->event_context.page_flip_handler = amdgpu_drm_queue_handler;
 
-- 
2.11.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* [PATCH xf86-video-ati] Set correct DRM event context version
       [not found] ` <20170410083751.19692-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2017-04-10  8:37   ` Michel Dänzer
       [not found]     ` <20170410083751.19692-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2017-04-10 14:51   ` [PATCH xf86-video-amdgpu] " Deucher, Alexander
  1 sibling, 1 reply; 6+ messages in thread
From: Michel Dänzer @ 2017-04-10  8:37 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Daniel Stone <daniels@collabora.com>

DRM_EVENT_CONTEXT_VERSION is the latest context version supported by
whatever version of libdrm is present. We were blindly asserting we
supported whatever version that may be, even if we actually didn't.

With libdrm 2.4.78, setting a higher context version than 2 will attempt
to call the page_flip_handler2 vfunc if it was non-NULL, which being a
random chunk of stack memory, it might well have been.

Set the version as 2, which should be bumped only with the appropriate
version checks.

Signed-off-by: Daniel Stone <daniels@collabora.com>
(Ported from xserver commit 0c8e6ed85810e96d84173a52d628863802a78d82)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index ab11583a6..9911c0a6a 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2538,7 +2538,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 
 	xf86InitialConfiguration(pScrn, TRUE);
 
-	drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
+	drmmode->event_context.version = 2;
 	drmmode->event_context.vblank_handler = radeon_drm_queue_handler;
 	drmmode->event_context.page_flip_handler = radeon_drm_queue_handler;
 
-- 
2.11.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH xf86-video-ati] Set correct DRM event context version
       [not found]     ` <20170410083751.19692-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2017-04-10  9:42       ` Emil Velikov
       [not found]         ` <CACvgo503KR+UdfiXQBuy7753tDhOSaF4yXP5vUvbFsw5L1ma-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2017-04-10 14:51       ` Deucher, Alexander
  1 sibling, 1 reply; 6+ messages in thread
From: Emil Velikov @ 2017-04-10  9:42 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: amd-gfx mailing list

On 10 April 2017 at 09:37, Michel Dänzer <michel@daenzer.net> wrote:
> From: Daniel Stone <daniels@collabora.com>
>
> DRM_EVENT_CONTEXT_VERSION is the latest context version supported by
> whatever version of libdrm is present. We were blindly asserting we
> supported whatever version that may be, even if we actually didn't.
>
> With libdrm 2.4.78, setting a higher context version than 2 will attempt
> to call the page_flip_handler2 vfunc if it was non-NULL, which being a
> random chunk of stack memory, it might well have been.
>
Should be safe since we use xnfcalloc [in RADEONGetRec].

Regardless, the amdgpu and ati patches are
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>

Thanks
Emil
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* RE: [PATCH xf86-video-amdgpu] Set correct DRM event context version
       [not found] ` <20170410083751.19692-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2017-04-10  8:37   ` [PATCH xf86-video-ati] " Michel Dänzer
@ 2017-04-10 14:51   ` Deucher, Alexander
  1 sibling, 0 replies; 6+ messages in thread
From: Deucher, Alexander @ 2017-04-10 14:51 UTC (permalink / raw)
  To: 'Michel Dänzer', amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
> Of Michel Dänzer
> Sent: Monday, April 10, 2017 4:38 AM
> To: amd-gfx@lists.freedesktop.org
> Subject: [PATCH xf86-video-amdgpu] Set correct DRM event context version
> 
> From: Daniel Stone <daniels@collabora.com>
> 
> DRM_EVENT_CONTEXT_VERSION is the latest context version supported by
> whatever version of libdrm is present. We were blindly asserting we
> supported whatever version that may be, even if we actually didn't.
> 
> With libdrm 2.4.78, setting a higher context version than 2 will attempt
> to call the page_flip_handler2 vfunc if it was non-NULL, which being a
> random chunk of stack memory, it might well have been.
> 
> Set the version as 2, which should be bumped only with the appropriate
> version checks.
> 
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> (Ported from xserver commit
> 0c8e6ed85810e96d84173a52d628863802a78d82)
> 
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  src/drmmode_display.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 2cdea90ad..f58d28f1a 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -2362,7 +2362,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn,
> drmmode_ptr drmmode, int cpp)
> 
>  	xf86InitialConfiguration(pScrn, TRUE);
> 
> -	drmmode->event_context.version =
> DRM_EVENT_CONTEXT_VERSION;
> +	drmmode->event_context.version = 2;
>  	drmmode->event_context.vblank_handler =
> amdgpu_drm_queue_handler;
>  	drmmode->event_context.page_flip_handler =
> amdgpu_drm_queue_handler;
> 
> --
> 2.11.0
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* RE: [PATCH xf86-video-ati] Set correct DRM event context version
       [not found]     ` <20170410083751.19692-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
  2017-04-10  9:42       ` Emil Velikov
@ 2017-04-10 14:51       ` Deucher, Alexander
  1 sibling, 0 replies; 6+ messages in thread
From: Deucher, Alexander @ 2017-04-10 14:51 UTC (permalink / raw)
  To: 'Michel Dänzer', amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
> Of Michel Dänzer
> Sent: Monday, April 10, 2017 4:38 AM
> To: amd-gfx@lists.freedesktop.org
> Subject: [PATCH xf86-video-ati] Set correct DRM event context version
> 
> From: Daniel Stone <daniels@collabora.com>
> 
> DRM_EVENT_CONTEXT_VERSION is the latest context version supported by
> whatever version of libdrm is present. We were blindly asserting we
> supported whatever version that may be, even if we actually didn't.
> 
> With libdrm 2.4.78, setting a higher context version than 2 will attempt
> to call the page_flip_handler2 vfunc if it was non-NULL, which being a
> random chunk of stack memory, it might well have been.
> 
> Set the version as 2, which should be bumped only with the appropriate
> version checks.
> 
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> (Ported from xserver commit
> 0c8e6ed85810e96d84173a52d628863802a78d82)
> 
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  src/drmmode_display.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index ab11583a6..9911c0a6a 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -2538,7 +2538,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn,
> drmmode_ptr drmmode, int cpp)
> 
>  	xf86InitialConfiguration(pScrn, TRUE);
> 
> -	drmmode->event_context.version =
> DRM_EVENT_CONTEXT_VERSION;
> +	drmmode->event_context.version = 2;
>  	drmmode->event_context.vblank_handler =
> radeon_drm_queue_handler;
>  	drmmode->event_context.page_flip_handler =
> radeon_drm_queue_handler;
> 
> --
> 2.11.0
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH xf86-video-ati] Set correct DRM event context version
       [not found]         ` <CACvgo503KR+UdfiXQBuy7753tDhOSaF4yXP5vUvbFsw5L1ma-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-04-11  5:58           ` Michel Dänzer
  0 siblings, 0 replies; 6+ messages in thread
From: Michel Dänzer @ 2017-04-11  5:58 UTC (permalink / raw)
  To: Emil Velikov; +Cc: Daniel Stone, amd-gfx mailing list

On 10/04/17 06:42 PM, Emil Velikov wrote:
> On 10 April 2017 at 09:37, Michel Dänzer <michel@daenzer.net> wrote:
>> From: Daniel Stone <daniels@collabora.com>
>>
>> DRM_EVENT_CONTEXT_VERSION is the latest context version supported by
>> whatever version of libdrm is present. We were blindly asserting we
>> supported whatever version that may be, even if we actually didn't.
>>
>> With libdrm 2.4.78, setting a higher context version than 2 will attempt
>> to call the page_flip_handler2 vfunc if it was non-NULL, which being a
>> random chunk of stack memory, it might well have been.
>>
> Should be safe since we use xnfcalloc [in RADEONGetRec].

That's a good point, thanks (applies equally to the modesetting driver
AFAICT); I'll drop the second paragraph from the commit log.


> Regardless, the amdgpu and ati patches are
> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>

Thanks!


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2017-04-11  5:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-10  8:37 [PATCH xf86-video-amdgpu] Set correct DRM event context version Michel Dänzer
     [not found] ` <20170410083751.19692-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-04-10  8:37   ` [PATCH xf86-video-ati] " Michel Dänzer
     [not found]     ` <20170410083751.19692-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-04-10  9:42       ` Emil Velikov
     [not found]         ` <CACvgo503KR+UdfiXQBuy7753tDhOSaF4yXP5vUvbFsw5L1ma-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-11  5:58           ` Michel Dänzer
2017-04-10 14:51       ` Deucher, Alexander
2017-04-10 14:51   ` [PATCH xf86-video-amdgpu] " Deucher, Alexander

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.