[PATCH i-g-t v2] tests/kms_invalid_mode: Attempt divide-by-zero in drm_mode_vrefresh()
Ville Syrjala
ville.syrjala at linux.intel.com
Thu Nov 28 19:09:27 UTC 2024
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Add a new subtest which attempts to invoke a div-by-zero via
an overflow in drm_mode_vrefresh() (found by syzbot).
v2: Fix the docs
Link: https://syzkaller.appspot.com/bug?extid=622bba18029bcde672e1
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
tests/kms_invalid_mode.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tests/kms_invalid_mode.c b/tests/kms_invalid_mode.c
index 4fd644594ef9..1ebce4df3616 100644
--- a/tests/kms_invalid_mode.c
+++ b/tests/kms_invalid_mode.c
@@ -56,6 +56,7 @@
* @zero-clock: Clock as zero
* @zero-hdisplay: hdisplay as zero
* @zero-vdisplay: vdisplay as zero
+ * @overflow-vrefresh: vrefresh calculation overflow
*/
IGT_TEST_DESCRIPTION("Make sure all modesets are rejected when the requested mode is invalid");
@@ -210,6 +211,20 @@ adjust_mode_bad_vtotal(data_t *data, drmModeModeInfoPtr mode)
return true;
}
+static bool
+adjust_mode_overflow_vrefresh(data_t *data, drmModeModeInfoPtr mode)
+{
+ /*
+ * htotal * vtotal * vscan == 2^32
+ * overflow during vrefresh calculation
+ */
+ mode->htotal = 32768;
+ mode->vtotal = 32768;
+ mode->vscan = 4;
+
+ return true;
+}
+
static void
test_output(data_t *data)
{
@@ -285,6 +300,9 @@ static const struct {
{ .name = "bad-vtotal",
.adjust_mode = adjust_mode_bad_vtotal,
},
+ { .name = "overflow-vrefresh",
+ .adjust_mode = adjust_mode_overflow_vrefresh,
+ },
};
static data_t data;
--
2.45.2
More information about the igt-dev
mailing list