Skip to content
Snippets Groups Projects
Commit c5f54721 authored by Vignesh Raman's avatar Vignesh Raman Committed by Kamil Konieczny
Browse files

lib/igt_kms: Fix memory corruption


virtio-gpu kernel driver, which provides KMS, reports 16 for count_crtcs
which exceeds IGT_MAX_PIPES set to 8. The function igt_display_require
allocates memory for IGT_MAX_PIPES members of igt_pipe_t structures,
but then writes into it based on the count_crtcs reported by the kernel,
resulting in memory corruption.

 # malloc(): corrupted top size
 # Received signal SIGABRT.
 # Stack trace:
 #  #0 [fatal_sig_handler+0x17b]
 #  #1 [__sigaction+0x40]
 #  #2 [pthread_key_delete+0x14c]
 #  #3 [gsignal+0x12]
 #  #4 [abort+0xd3]
 #  #5 [__fsetlocking+0x290]
 #  #6 [timer_settime+0x37a]
 #  #7 [__default_morecore+0x1f1b]
 #  #8 [__libc_calloc+0x161]
 #  #9 [drmModeGetPlaneResources+0x44]
 #  #10 [igt_display_require+0x194]
 #  #11 [__igt_unique____real_main1356+0x93c]
 #  #12 [main+0x3f]
 #  #13 [__libc_init_first+0x8a]
 #  #14 [__libc_start_main+0x85]
 #  #15 [_start+0x21]

Increase IGT_MAX_PIPES to 16 to fix this memory corruption issue.
igt_display_require initializes display and allocate resources as
a prerequisite for the tests. Skip the test if count_crtcs exceeds
IGT_MAX_PIPES with debug information.

This fix is required for drm-ci to run igt tests on virtio-gpu.

Reviewed-by: default avatarBhanuprakash Modem <bhanuprakash.modem@intel.com>
Reviewed-by: default avatarDaniel Stone <daniels@collabora.com>
Acked-by: default avatarHelen Koike <helen.koike@collabora.com>
Suggested-by: default avatarDaniel Stone <daniels@collabora.com>
Suggested-by: default avatarBhanuprakash Modem <bhanuprakash.modem@intel.com>
Signed-off-by: default avatarVignesh Raman <vignesh.raman@collabora.com>
parent 0e65d4f8
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment