[PATCH i-g-t v2] tests/kms_invalid_mode: Attempt divide-by-zero in drm_mode_vrefresh()
Nautiyal, Ankit K
ankit.k.nautiyal at intel.com
Fri Nov 29 03:46:45 UTC 2024
On 11/29/2024 12:39 AM, Ville Syrjala wrote:
> 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>
Catching the issue nicely:
https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_12217/shard-mtlp-5/igt@kms_invalid_mode@overflow-vrefresh.html#dmesg-warnings177
LGTM.
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal at 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;
More information about the igt-dev
mailing list