[igt-dev] [PATCH i-g-t 06/10] lib/tests/igt_fork.c: Fix error in mmap() flags
Jake Freeland
jake at technologyfriends.net
Fri Oct 7 14:54:48 UTC 2022
Kamil,
I just submitted the patch independently.
https://patchwork.freedesktop.org/patch/506280/
Jake Freeland
On Fri, Oct 7, 2022 at 5:55 AM Kamil Konieczny <
kamil.konieczny at linux.intel.com> wrote:
> Hi Jake,
>
> On 2022-10-06 at 23:07:14 -0500, Jake Freeland wrote:
> > 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 at freebsd.org>
>
> Nice catch, please send this outside of your series, it can be
> merged as a fix.
>
> Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
>
> Regards,
> Kamil
>
> > ---
> > 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.3
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20221007/1442cbe9/attachment.htm>
More information about the igt-dev
mailing list