[PATCH i-g-t] 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:45:01 UTC 2024


On 11/27/2024 4:30 PM, 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).
>
> 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 | 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;


More information about the igt-dev mailing list