Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Senna Tschudin <me@petersenna.com>
To: igt-dev@lists.freedesktop.org, kamil.konieczny@linux.intel.com,
	andi.shyti@linux.intel.com
Subject: [PATCH i-g-t] tests/intel/gem_exec_capture: fix use of igt_allow_hang() / igt_disallow_hang()
Date: Thu, 11 Apr 2024 21:19:23 +0200	[thread overview]
Message-ID: <20240411191934.10368-1-me@petersenna.com> (raw)

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


             reply	other threads:[~2024-04-11 19:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 19:19 Peter Senna Tschudin [this message]
2024-04-11 20:25 ` ✓ CI.xeBAT: success for tests/intel/gem_exec_capture: fix use of igt_allow_hang() / igt_disallow_hang() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240411191934.10368-1-me@petersenna.com \
    --to=me@petersenna.com \
    --cc=andi.shyti@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox