Skip to contentSkip to conversation

drm: Fix uabi regression by allowing garbage mode->type from userspace

PATCH In review Ville Syrjala 5 participants 8 messages Mar 21, 2018 – Mar 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Fix uabi regression by allowing garbage mode->type from userspace

From: Ville Syrjälä <[email protected]>

Apparently xf86-video-vmware leaves the mode->type uninitialized when feeding the mode to the kernel. Thus we have no choice but to accept the garbage in. We'll just ignore any of the bits we don't want. The mode type is just a hint anyway, and more useful for the kernel->userspace direction.

CC Thomas Hellstrom <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Alex Deucher <[email protected]>
Fixes c6ed6dad5cfb ("drm/uapi: Validate the mode flags/type")

References: https://lists.freedesktop.org/archives/dri-devel/2018-March/170213.html

---
 drivers/gpu/drm/drm_modes.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_modes.c +7 -1
index f6b7c0e36a1a..e82b61e08f8c 100644
@@ -1611,7 +1611,13 @@ int drm_mode_convert_umode(struct drm_device *dev,
 	out->vscan = in->vscan;
 	out->vrefresh = in->vrefresh;
 	out->flags = in->flags;
-	out->type = in->type;
+	/*
+	 * Old xf86-video-vmware (possibly others too) used to
+	 * leave 'type' unititialized. Just ignore any bits we
+	 * don't like. It's a just hint after all, and more
+	 * useful for the kernel->userspace direction anyway.
+	 */
+	out->type = in->type & DRM_MODE_TYPE_ALL;
 	strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
 	out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
 
Signature · 6 lines
2.16.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

✗ Fi.CI.CHECKPATCH: warning for drm: Fix uabi regression by allowing garbage mode->type from userspace

== Series Details ==

== Series Details ==

Series: drm: Fix uabi regression by allowing garbage mode->type from userspace
URL : https://patchwork.freedesktop.org/series/40416/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
1ace93ec3e0c drm: Fix uabi regression by allowing garbage mode->type from userspace
-:21: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#21: 
References: https://lists.freedesktop.org/archives/dri-devel/2018-March/170213.html

total: 0 errors, 1 warnings, 0 checks, 14 lines checked

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✓ Fi.CI.BAT: success for drm: Fix uabi regression by allowing garbage mode->type from userspace

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: drm: Fix uabi regression by allowing garbage mode->type from userspace
URL : https://patchwork.freedesktop.org/series/40416/
State : success

== Summary ==

Series 40416v1 drm: Fix uabi regression by allowing garbage mode->type from userspace
https://patchwork.freedesktop.org/api/1.0/series/40416/revisions/1/mbox/

---- Known issues:

Test debugfs_test:

        Subgroup read_all_entries:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                fail       -> PASS       (fi-skl-6770hq) fdo#100368

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:430s
fi-bdw-gvtdvm    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:444s
fi-blb-e6850     total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:379s
fi-bsw-n3050     total:285  pass:239  dwarn:0   dfail:0   fail:0   skip:46  time:534s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:298s
fi-bxt-dsi       total:285  pass:255  dwarn:0   dfail:0   fail:0   skip:30  time:517s
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:510s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:513s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:508s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:418s
fi-cfl-s2        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:566s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:512s
fi-cnl-drrs      total:285  pass:254  dwarn:3   dfail:0   fail:0   skip:28  time:546s
fi-cnl-y3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:579s
fi-elk-e7500     total:285  pass:225  dwarn:1   dfail:0   fail:0   skip:59  time:422s
fi-gdg-551       total:285  pass:176  dwarn:0   dfail:0   fail:1   skip:108 time:318s
fi-glk-1         total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:537s
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:403s
fi-ilk-650       total:285  pass:225  dwarn:0   dfail:0   fail:0   skip:60  time:424s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:475s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:432s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:0   skip:24  time:476s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:469s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:514s
fi-pnv-d510      total:285  pass:219  dwarn:1   dfail:0   fail:0   skip:65  time:647s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:439s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:534s
fi-skl-6700k2    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:501s
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:505s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:428s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:445s
fi-snb-2520m     total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:575s
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:406s

dff9ece60048108782aab6d6123822c1d34b0e5a drm-tip: 2018y-03m-21d-20h-44m-14s UTC integration manifest 1ace93ec3e0c drm: Fix uabi regression by allowing garbage mode->type from userspace

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8441/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✓ Fi.CI.IGT: success for drm: Fix uabi regression by allowing garbage mode->type from userspace

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: drm: Fix uabi regression by allowing garbage mode->type from userspace
URL : https://patchwork.freedesktop.org/series/40416/
State : success

== Summary ==

---- Known issues:

Test kms_flip:

        Subgroup flip-vs-wf_vblank-interruptible:
                fail       -> PASS       (shard-hsw) fdo#100368 +1
Test kms_frontbuffer_tracking:
        Subgroup basic:
                pass       -> FAIL       (shard-apl) fdo#103167
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-a-frame-sequence:
                pass       -> FAIL       (shard-hsw) fdo#103481
Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-apl) fdo#99912

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103481 https://bugs.freedesktop.org/show_bug.cgi?id=103481
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

shard-apl        total:3478 pass:1814 dwarn:1   dfail:0   fail:8   skip:1655 time:13071s
shard-hsw        total:3478 pass:1766 dwarn:1   dfail:0   fail:3   skip:1707 time:11879s
shard-snb        total:3478 pass:1357 dwarn:1   dfail:0   fail:3   skip:2117 time:7296s

Blacklisted hosts:
shard-kbl total:3478 pass:1940 dwarn:1 dfail:0 fail:9 skip:1528 time:9928s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8441/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Tested-by on v1 1/1
#4 lore raw
In reply to Ville Syrjala
Quoted 28 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Apparently xf86-video-vmware leaves the mode->type uninitialized when feeding the mode to the kernel. Thus we have no choice but to accept the garbage in. We'll just ignore any of the bits we don't want. The mode type is just a hint anyway, and more useful for the kernel->userspace direction.

CC Thomas Hellstrom <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Alex Deucher <[email protected]>
Fixes c6ed6dad5cfb ("drm/uapi: Validate the mode flags/type")

References: https://lists.freedesktop.org/archives/dri-devel/2018-March/170213.html

---
  drivers/gpu/drm/drm_modes.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_modes.c +0 -1
index f6b7c0e36a1a..e82b61e08f8c 100644
@@ -1611,7 +1611,13 @@ int drm_mode_convert_umode(struct drm_device *dev,
  	out->vscan = in->vscan;
  	out->vrefresh = in->vrefresh;
  	out->flags = in->flags;
-	out->type = in->type;

drivers/gpu/drm/drm_modes.c int drm_mode_convert_umode(struct drm_device *dev, · line 1623

Quoted 10 lines
drivers/gpu/drm/drm_modes.c +7 -0
+	/*
+	 * Old xf86-video-vmware (possibly others too) used to
+	 * leave 'type' unititialized. Just ignore any bits we
+	 * don't like. It's a just hint after all, and more
+	 * useful for the kernel->userspace direction anyway.
+	 */
+	out->type = in->type & DRM_MODE_TYPE_ALL;
  	strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
  	out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
 

Thanks,

Thomas

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer Reviewed-by
#5 lore raw

Op 22-03-18 om 08:42 schreef Thomas Hellstrom:

Quoted 44 lines · Ville Syrjala
Quoted 37 lines

From: Ville Syrjälä <[email protected]>

Apparently xf86-video-vmware leaves the mode->type uninitialized when feeding the mode to the kernel. Thus we have no choice but to accept the garbage in. We'll just ignore any of the bits we don't want. The mode type is just a hint anyway, and more useful for the kernel->userspace direction.

CC Thomas Hellstrom <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Alex Deucher <[email protected]>
Fixes c6ed6dad5cfb ("drm/uapi: Validate the mode flags/type")

References: https://lists.freedesktop.org/archives/dri-devel/2018-March/170213.html

---
  drivers/gpu/drm/drm_modes.c | 8 +++++++-

  1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_modes.c +7 -1
index f6b7c0e36a1a..e82b61e08f8c 100644
@@ -1611,7 +1611,13 @@ int drm_mode_convert_umode(struct drm_device *dev,
       out->vscan = in->vscan;
       out->vrefresh = in->vrefresh;
       out->flags = in->flags;
-    out->type = in->type;
+    /*
+     * Old xf86-video-vmware (possibly others too) used to
+     * leave 'type' unititialized. Just ignore any bits we
+     * don't like. It's a just hint after all, and more
+     * useful for the kernel->userspace direction anyway.
+     */
+    out->type = in->type & DRM_MODE_TYPE_ALL;
       strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
       out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
Quoted 1 line

Thanks,

Quoted 7 lines

Thomas

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author Applied
#6 lore raw
In reply to Thomas Hellstrom
Quoted 33 lines · Thomas Hellstrom
Quoted 32 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

Apparently xf86-video-vmware leaves the mode->type uninitialized when feeding the mode to the kernel. Thus we have no choice but to accept the garbage in. We'll just ignore any of the bits we don't want. The mode type is just a hint anyway, and more useful for the kernel->userspace direction.

CC Thomas Hellstrom <[email protected]>
Cc Adam Jackson <[email protected]>
Cc Alex Deucher <[email protected]>
Fixes c6ed6dad5cfb ("drm/uapi: Validate the mode flags/type")

References: https://lists.freedesktop.org/archives/dri-devel/2018-March/170213.html

---
  drivers/gpu/drm/drm_modes.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_modes.c +4 -1
index f6b7c0e36a1a..e82b61e08f8c 100644
@@ -1611,7 +1611,13 @@ int drm_mode_convert_umode(struct drm_device *dev,
  	out->vscan = in->vscan;
  	out->vrefresh = in->vrefresh;
  	out->flags = in->flags;
-	out->type = in->type;
+	/*
+	 * Old xf86-video-vmware (possibly others too) used to
+	 * leave 'type' unititialized. Just ignore any bits we
+	 * don't like. It's a just hint after all, and more
Quoted 8 lines

drivers/gpu/drm/drm_modes.c int drm_mode_convert_umode(struct drm_device *dev, · line 1623

Quoted 6 lines
drivers/gpu/drm/drm_modes.c +3 -0
+	 * useful for the kernel->userspace direction anyway.
+	 */
+	out->type = in->type & DRM_MODE_TYPE_ALL;
  	strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
  	out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
 

Thanks for the testing and reviews. And sorry for the extra hassle.

Pushed to drm-misc-next-fixes.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#7 lore raw
In reply to Ville Syrjala
Quoted 5 lines · Ville Syrjala

Apparently xf86-video-vmware leaves the mode->type uninitialized when feeding the mode to the kernel. Thus we have no choice but to accept the garbage in. We'll just ignore any of the bits we don't want. The mode type is just a hint anyway, and more useful for the kernel->userspace direction.

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx