Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/intel/gem_exec_capture: fix use of igt_allow_hang() / igt_disallow_hang()
@ 2024-04-11 19:19 Peter Senna Tschudin
  2024-04-11 20:25 ` ✓ CI.xeBAT: success for " Patchwork
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Peter Senna Tschudin @ 2024-04-11 19:19 UTC (permalink / raw)
  To: igt-dev, kamil.konieczny, andi.shyti

The function main has a variable igt_hang_t hang defined, and it is
currently used by igt_disallow_hang(). However igt_disallow_hang() is
using the variable uninitialized making valgrind unhappy:

 Syscall param ioctl(generic) points to uninitialised byte(s)
    at 0x4ACD3ED: ioctl (in /usr/lib64/libc.so.6)
    by 0x49ACF4F: drmIoctl (xf86drm.c:704)
    by 0x488AF46: __gem_context_set_param (gem_context.c:260)
    by 0x48A4D9F: context_set_ban (igt_gt.c:161)
    by 0x48A53DC: igt_disallow_hang (igt_gt.c:228)
    by 0x4013D7: __igt_unique____real_main959 (gem_exec_capture.c:1069)
    by 0x401242: main (gem_exec_capture.c:959)
  Address 0x1fff000170 is on thread 1's stack
  in frame #3, created by context_set_ban (igt_gt.c:154)
  Uninitialised value was created by a stack allocation
    at 0x401340: __igt_unique____real_main959 (gem_exec_capture.c:960)

 Conditional jump or move depends on uninitialised value(s)
    at 0x48A53E2: igt_disallow_hang (igt_gt.c:230)
    by 0x4013D7: __igt_unique____real_main959 (gem_exec_capture.c:1069)
    by 0x401242: main (gem_exec_capture.c:959)
  Uninitialised value was created by a stack allocation
    at 0x401340: __igt_unique____real_main959 (gem_exec_capture.c:960)

 Syscall param ioctl(generic) points to uninitialised byte(s)
    at 0x4ACD3ED: ioctl (in /usr/lib64/libc.so.6)
    by 0x49ACF4F: drmIoctl (xf86drm.c:704)
    by 0x488AF46: __gem_context_set_param (gem_context.c:260)
    by 0x48A540A: igt_disallow_hang (igt_gt.c:236)
    by 0x4013D7: __igt_unique____real_main959 (gem_exec_capture.c:1069)
    by 0x401242: main (gem_exec_capture.c:959)
  Address 0x1fff0001b0 is on thread 1's stack
  in frame #3, created by igt_disallow_hang (igt_gt.c:224)
  Uninitialised value was created by a stack allocation
    at 0x401340: __igt_unique____real_main959 (gem_exec_capture.c:960)

This patch sets the content of the variable hang with the return value
of igt_allow_hang() following what is used elsewhere in the codebase.
After this patch valgrind does not complain about the  errors listed.

Signed-off-by: Peter Senna Tschudin <me@petersenna.com>
---
 tests/intel/gem_exec_capture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/intel/gem_exec_capture.c b/tests/intel/gem_exec_capture.c
index 8800fa586..e462aa96f 100644
--- a/tests/intel/gem_exec_capture.c
+++ b/tests/intel/gem_exec_capture.c
@@ -990,7 +990,7 @@ igt_main
 
 			gem_context_set_param(fd, &param);
 		}
-		igt_allow_hang(fd, ctx->id, HANG_ALLOW_CAPTURE | HANG_WANT_ENGINE_RESET);
+		hang = igt_allow_hang(fd, ctx->id, HANG_ALLOW_CAPTURE | HANG_WANT_ENGINE_RESET);
 
 		dir = igt_sysfs_open(fd);
 		igt_require(igt_sysfs_set(dir, "error", "Begone!"));
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-04-24 12:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-11 19:19 [PATCH i-g-t] tests/intel/gem_exec_capture: fix use of igt_allow_hang() / igt_disallow_hang() Peter Senna Tschudin
2024-04-11 20:25 ` ✓ CI.xeBAT: success for " Patchwork
2024-04-11 20:28 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-04-12  3:34 ` ✗ CI.xeFULL: " Patchwork
2024-04-19 14:37 ` [PATCH i-g-t] " Kamil Konieczny
2024-04-19 17:29 ` [PATCH i-g-t v2] tests/intel/gem_exec_capture: fix use of uninitialized hang var Peter Senna Tschudin
2024-04-19 19:03 ` ✓ Fi.CI.BAT: success for tests/intel/gem_exec_capture: fix use of igt_allow_hang() / igt_disallow_hang() (rev2) Patchwork
2024-04-19 20:16 ` ✓ CI.xeBAT: " Patchwork
2024-04-20  1:56 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-04-22 11:35   ` Kamil Konieczny
2024-04-24 12:40     ` Illipilli, TejasreeX
2024-04-24  6:45 ` ✓ Fi.CI.IGT: success " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox