All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib/tests/igt_fork.c: Fix error in mmap() flags
@ 2022-10-07 14:52 Jake Freeland
  2022-10-07 15:04 ` Ville Syrjälä
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Jake Freeland @ 2022-10-07 14:52 UTC (permalink / raw)
  To: igt-dev; +Cc: Jake Freeland

In subtest_leak(), mmap() is called with the flag PROT_WRITE,
but no PROT_READ. Later in the function, the mapped memory is
read using `children[i]`. In FreeBSD, the lack of PROT_READ
causes SIGSEGV. Adding the PROT_READ flag to the mmap() call
fixes this.

Signed-off-by: Jake Freeland <jfree@freebsd.org>
---
 lib/tests/igt_fork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tests/igt_fork.c b/lib/tests/igt_fork.c
index d19d0945..d883aba4 100644
--- a/lib/tests/igt_fork.c
+++ b/lib/tests/igt_fork.c
@@ -109,7 +109,7 @@ __noreturn static void igt_fork_timeout_leak(void)
 __noreturn static void subtest_leak(void)
 {
 	pid_t *children =
-		mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+		mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	const int num_children = 4096 / sizeof(*children);
 
 	igt_subtest_init(fake_argc, fake_argv);
-- 
2.37.0 (Apple Git-136)

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

end of thread, other threads:[~2022-10-09 17:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-07 14:52 [igt-dev] [PATCH i-g-t] lib/tests/igt_fork.c: Fix error in mmap() flags Jake Freeland
2022-10-07 15:04 ` Ville Syrjälä
2022-10-07 15:44   ` Ville Syrjälä
2022-10-07 15:35 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2022-10-07 19:10   ` Kamil Konieczny
2022-10-09 16:28     ` Vudum, Lakshminarayana
2022-10-07 19:08 ` [igt-dev] [PATCH i-g-t] " Kamil Konieczny
2022-10-07 20:18   ` Jake Freeland
2022-10-09 16:08 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2022-10-09 16:18 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2022-10-09 17:42 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.