Skip to contentSkip to conversation

Set correct DRM event context version

PATCH In review Michel Dänzer 3 participants 6 messages Apr 10, 2017 – Apr 11, 2017 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Set correct DRM event context version

From: Daniel Stone <[email protected]>

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.

(Ported from xserver commit 0c8e6ed85810e96d84173a52d628863802a78d82)

---
 src/drmmode_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/drmmode_display.c +1 -1
index 2cdea90ad..f58d28f1a 100644
@@ -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;
 
Signature · 6 lines
2.11.0

_______________________________________________
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): 20170410083751.19692-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

#2 lore raw

PATCH 1/1 Set correct DRM event context version

From: Daniel Stone <[email protected]>

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.

(Ported from xserver commit 0c8e6ed85810e96d84173a52d628863802a78d82)

---
 src/drmmode_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/drmmode_display.c +1 -1
index ab11583a6..9911c0a6a 100644
@@ -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;
 
Signature · 6 lines
2.11.0

_______________________________________________
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): 20170410083751.19692-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#4 lore raw
Quoted 10 lines · Michel Dänzer

From: Daniel Stone <[email protected]>

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

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): CACvgo503KR+UdfiXQBuy7753tDhOSaF4yXP5vUvbFsw5L1ma-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw
Quoted 7 lines · Emil Velikov
Quoted 6 lines · Michel Dänzer

From: Daniel Stone <[email protected]>

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.

Quoted 5 lines
Quoted 4 lines

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.

Quoted 2 lines

Regardless, the amdgpu and ati patches are

Thanks!

Signature · 7 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
Reviewed-by Alex Deucher
#7 lore raw
In reply to a message not in the archive
Quoted 17 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Monday, April 10, 2017 4:38 AM
To: [email protected]
Subject: [PATCH xf86-video-ati] Set correct DRM event context version

From: Daniel Stone <[email protected]>

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.

Quoted 8 lines

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

(Ported from xserver commit
0c8e6ed85810e96d84173a52d628863802a78d82)

Quoted 21 lines
---
 src/drmmode_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/drmmode_display.c +1 -1
index ab11583a6..9911c0a6a 100644
@@ -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;

Quoted 7 lines

--
2.11.0

_______________________________________________
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

Reviewed-by Alex Deucher
#8 lore raw
In reply to a message not in the archive
Quoted 17 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Monday, April 10, 2017 4:38 AM
To: [email protected]
Subject: [PATCH xf86-video-amdgpu] Set correct DRM event context version

From: Daniel Stone <[email protected]>

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.

Quoted 8 lines

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

(Ported from xserver commit
0c8e6ed85810e96d84173a52d628863802a78d82)

Quoted 21 lines
---
 src/drmmode_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/drmmode_display.c +1 -1
index 2cdea90ad..f58d28f1a 100644
@@ -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;

Quoted 7 lines

--
2.11.0

_______________________________________________
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