Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1704973rwo; Wed, 2 Aug 2023 20:25:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlGNtpZY6bsUSUACHaemWkyCvig2keb9C7G1x9hXrJ/NZeaHgGtz6tjnwXwOeGfh8jIAOH8v X-Received: by 2002:aa7:c442:0:b0:522:2bdc:97bc with SMTP id n2-20020aa7c442000000b005222bdc97bcmr6916800edr.24.1691033124308; Wed, 02 Aug 2023 20:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691033124; cv=none; d=google.com; s=arc-20160816; b=omqJai+B8uAlgZhN5llmggIalZOuWW3vZ05URuwWzXO6Gy8aXNeehlZGXStZ1x/39E BgZsRFrOsSzMRc9XONL0X53KNiObpRfe7GJVe/Se2l3UIp6+IDWfCD57X2OzrWRC/BYq UswnMbuUmRhA3CxWFiR9dD4+RjpKkzWX2p/z/oKPuvnrmpUckBwGwZ9nAxTsWKmu1fWy DQMzp5UHjS+KMcoSAZZYSAnk6DdDvfrvPLGA2zHKAzrU4rIKBOjlf3PXmBPeu0le9UYk 6FQe00aIXxrVNmJtarJ6GbKJXsYiq7fx0E596IdGvgOqqkyRL1WOuj4W515edpZ+tkw/ YK+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=M31TVCZOo8aoSS85FtlkHAzcBWuXDtd8o0N06bFn5DM=; fh=eeBjHOberayco3R3iTwlLaD0VnrLYPJeZOQGfhuTHEo=; b=BRTu/wIEPiBD1tEosQ/roX3DMGkkx1tUCfHCBI9nwhyeTFPtblHxt5pXeoon6Su7Xc 4HJUkp1hflvq36AZMfnxPVkWD5Yn8woyk2Yct0jFRFyHum6oi3YwM97g5toZ64gsOdzA qbauvBYZ/hTV6DMLyYy7m7sDVlTErs8YT/zxNaWoeT3W01KgalnWQk9OQHLrkSE6bk5z t3HBPb4fuEUNv/281Zft1iu49W0uI6XDptIZuVulykBKqss+zNE6NrQc2OUDSmMvMERi 0ONLusl2TE37lLHkOPu1GmokeEGhCLmZVBq9BaOIJw53J532R4zB1F1KyRyTMfYbcOdV Jm3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=LHuFwi6P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020aa7ccc3000000b00521e784bbbesi10917311edt.15.2023.08.02.20.25.00; Wed, 02 Aug 2023 20:25:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=LHuFwi6P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232372AbjHCCz6 (ORCPT + 99 others); Wed, 2 Aug 2023 22:55:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230393AbjHCCz4 (ORCPT ); Wed, 2 Aug 2023 22:55:56 -0400 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BF6E1B6 for ; Wed, 2 Aug 2023 19:55:55 -0700 (PDT) Received: by mail-qt1-x82f.google.com with SMTP id d75a77b69052e-407db3e9669so95061cf.1 for ; Wed, 02 Aug 2023 19:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691031354; x=1691636154; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=M31TVCZOo8aoSS85FtlkHAzcBWuXDtd8o0N06bFn5DM=; b=LHuFwi6Pl0tqGmEPZsDQ1WC65AmISRKLv2O1hD7+29C6o1j2vf3ffYQ8roiyhSns3C VM/bQEGSRB2lsQu5ehFiYLTLtdQaYtwcIE5i6feO4XiWeQ6+xNkb8ZzRE1BqfwjBfN9d UlYnVi5r18K2v3B1aUMjVfI+ohF5Uso6P1oxC8yg4W6R2wJo8h0Gl9V4OkIU4N7aHp/u xRyxhl+6vnhFDsK2LRVmGVEert0btyaCxbjgvgmufW7p2zbZOo69gwsVx+hpmoMFh7Qk KOPE4bBLRgtwouhGH6t7CnT3phYoMfT7oajwWhiyOOvzX7W37b85Fjv0QoNjwvq4wKsn pJQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691031354; x=1691636154; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M31TVCZOo8aoSS85FtlkHAzcBWuXDtd8o0N06bFn5DM=; b=B2cuo6d6Fz62nYXeqa7Liu0fWhU7vA8JHvgDHcPrnILATqqTMNOZvte5w4Q9kFlrWi TBJ32Mbr25abAR/KdhE7SxHEmgHTp+BwFYPVBZ7dyVf/k/Zd3vOKW7FDWw/eZQynKIDY 9TgiybCzRviR6y3jRUDAn8iq+ZzclNm6AtNlp8ZYXYn1514iVbhfIROD3dJcvE/wRUp1 AuJr66szCB4vIfqUWu4oOl1m8zmg8pl9pyhcWtWy5KwzvlECLUbPQPPtd7qgHdrW4//U 1k3JmLPL68nWL4OPw/DWsPE2KiINvvoOqY0kG8pV3dpahTobLySh4j+yoITU4wlQsX5h lq1g== X-Gm-Message-State: ABy/qLbyMiFTLsyG2HZunYcmrdc2HHBIhULjh4qB3gGyggL/ExKaekmM 9dOfTbDgNi0VS5cRxF/mGo7L9y8KE5vdQtbYtTlyBw== X-Received: by 2002:ac8:5c05:0:b0:3f8:e0a:3e66 with SMTP id i5-20020ac85c05000000b003f80e0a3e66mr1528975qti.3.1691031354105; Wed, 02 Aug 2023 19:55:54 -0700 (PDT) MIME-Version: 1.0 References: <20230713143406.14342-1-cyphar@cyphar.com> <20230713143406.14342-4-cyphar@cyphar.com> <20230803.022458-mundane.voyage.tricky.kinship-yaSxczr9O6cB@cyphar.com> In-Reply-To: <20230803.022458-mundane.voyage.tricky.kinship-yaSxczr9O6cB@cyphar.com> From: Jeff Xu Date: Wed, 2 Aug 2023 19:55:16 -0700 Message-ID: Subject: Re: [RFC PATCH 3/3] selftests: memfd: error out test process when child test fails To: Aleksa Sarai Cc: Shuah Khan , Andrew Morton , Daniel Verkamp , Kees Cook , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 2, 2023 at 7:25=E2=80=AFPM Aleksa Sarai wro= te: > > On 2023-07-19, Jeff Xu wrote: > > On Thu, Jul 13, 2023 at 7:34=E2=80=AFAM Aleksa Sarai 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 > > > --- > > > 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/testi= ng/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) !=3D 0) { > > > + printf("newpid thread: exited with non-zero error cod= e %d\n", > > > + WEXITSTATUS(wstatus)); > > > + abort(); > > > + } > > > + > > > + if (WIFSIGNALED(wstatus)) { > > > + printf("newpid thread: killed by signal %d\n", > > > + WTERMSIG(wstatus)); > > > + abort(); > > > + } > > > } > > > > > Signed-off-by: Jeff Xu > > Did you mean for this to a Reviewed-by? > Yes! Thanks for asking. Reviewed-by: Jeff Xu > -- > Aleksa Sarai > Senior Software Engineer (Containers) > SUSE Linux GmbH >