lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230803.022458-mundane.voyage.tricky.kinship-yaSxczr9O6cB@cyphar.com>
Date:   Thu, 3 Aug 2023 12:25:42 +1000
From:   Aleksa Sarai <cyphar@...har.com>
To:     Jeff Xu <jeffxu@...gle.com>
Cc:     Shuah Khan <shuah@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Daniel Verkamp <dverkamp@...omium.org>,
        Kees Cook <keescook@...omium.org>, linux-mm@...ck.org,
        linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 3/3] selftests: memfd: error out test process when
 child test fails

On 2023-07-19, Jeff Xu <jeffxu@...gle.com> wrote:
> On Thu, Jul 13, 2023 at 7:34 AM Aleksa Sarai <cyphar@...har.com> wrote:
> >
> > Before this change, a test runner using this self test would see a
> > return code of 0 when the tests using a child process (namely the
> > MFD_NOEXEC_SEAL and MFD_EXEC tests) failed, masking test failures.
> >
> > Fixes: 11f75a01448f ("selftests/memfd: add tests for MFD_NOEXEC_SEAL MFD_EXEC")
> > Signed-off-by: Aleksa Sarai <cyphar@...har.com>
> > ---
> >  tools/testing/selftests/memfd/memfd_test.c | 19 ++++++++++++++++++-
> >  1 file changed, 18 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
> > index d8342989c547..8b7390ad81d1 100644
> > --- a/tools/testing/selftests/memfd/memfd_test.c
> > +++ b/tools/testing/selftests/memfd/memfd_test.c
> > @@ -1219,7 +1219,24 @@ static pid_t spawn_newpid_thread(unsigned int flags, int (*fn)(void *))
> >
> >  static void join_newpid_thread(pid_t pid)
> >  {
> > -       waitpid(pid, NULL, 0);
> > +       int wstatus;
> > +
> > +       if (waitpid(pid, &wstatus, 0) < 0) {
> > +               printf("newpid thread: waitpid() failed: %m\n");
> > +               abort();
> > +       }
> > +
> > +       if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) != 0) {
> > +               printf("newpid thread: exited with non-zero error code %d\n",
> > +                      WEXITSTATUS(wstatus));
> > +               abort();
> > +       }
> > +
> > +       if (WIFSIGNALED(wstatus)) {
> > +               printf("newpid thread: killed by signal %d\n",
> > +                      WTERMSIG(wstatus));
> > +               abort();
> > +       }
> >  }
> >
> Signed-off-by: Jeff Xu <jeffxu@...gle.com>

Did you mean for this to a Reviewed-by?

-- 
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ