[PATCH i-g-t] tests/kms_invalid_mode: Attempt divide-by-zero in drm_mode_vrefresh()
Ville Syrjala
ville.syrjala at linux.intel.com
Wed Nov 27 11:00:12 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).
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 | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tests/kms_invalid_mode.c b/tests/kms_invalid_mode.c
index 4fd644594ef9..5fa85338c799 100644
--- a/tests/kms_invalid_mode.c
+++ b/tests/kms_invalid_mode.c
@@ -210,6 +210,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 +299,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