Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1724062rwo; Wed, 2 Aug 2023 20:59:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlFpD33HdSM2EFCTxCl9+1tP/t1nZPiA3QGOSXsMrrXctzoaIS+9VG+emjjwGqvjM5zrwUjJ X-Received: by 2002:a17:903:41c4:b0:1b7:f443:c7f8 with SMTP id u4-20020a17090341c400b001b7f443c7f8mr19713393ple.15.1691035199249; Wed, 02 Aug 2023 20:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691035199; cv=none; d=google.com; s=arc-20160816; b=djguwPTpPUQhmhd6cg+EXxE7XUlnOR/y1E2u5Fpw3h0kCfWfKDXaFIKakQkEH70Lm3 yl+CcmBxYRmOxx3KBZICYSiAz5Fve0cNvscrsrc6X0svu3BmgqMR2IgHgVMDrvQCRxLI hPASBXeC/uJggT2ARvIcnboLiqYFO8vKB5L2MLPVNX5dXMTNDTQqEh+m9fZn9slQbdLe S08MgSvf+O5DAe0P0Stg/E9wBd0ve6xhmdLjUycJIW62g4ptVoZ4m282qCNNTucWXoa8 Yim8Yo2HncIFR0XthZ70JhcIDKNog6HzIOaq5C347ceyp0XkEIUULZhkUb4Ua+j+FUwd Qp/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QDaQQq8N3pV/0zOSm0S8Jmeu7eQz2E5FW0Ju7kYcogY=; fh=FUkUMZvqxCz4j8ZGTgymV3Y3Ss/1g0DRVoJXN+fGBmw=; b=fZFedJyE+9Np4MvhJp4FrVdVr2oof+pREzu00/fE/N7/ik/0+wEN/ekASwK9Wu3LXJ CchwPCG9qE+0Y3mvKs+gu8MN+vV2OSeWBnjXh1DSvA/wRvxbcN8K2sbwsR4GqZ+/QM/Y gySQWlIr6CBOtby5WW6vLBA4E7HSa1b2JAgzbPnpIZtbMQGsVmqDCi4oSOlVMSiCcn/R ywv8usRBQm3eazHaV6i7o0HxwykPZVnnl3d9JWF5HQaNXQURXP1j2c8yHgB2I6INm2Za ygqzKBbHedF9rMvMN5R+aM26J+OyrX1aC8sXKM9WDBt8g3CfTR3IukjF1pSC6a0ODzex tByA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cyphar.com header.s=MBO0001 header.b=Y1QMaVE0; 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=cyphar.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kl15-20020a170903074f00b001b89b691c7asi11729196plb.196.2023.08.02.20.59.46; Wed, 02 Aug 2023 20:59:59 -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=@cyphar.com header.s=MBO0001 header.b=Y1QMaVE0; 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=cyphar.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233620AbjHCCgf (ORCPT + 99 others); Wed, 2 Aug 2023 22:36:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbjHCCgQ (ORCPT ); Wed, 2 Aug 2023 22:36:16 -0400 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75ACF4C0E; Wed, 2 Aug 2023 19:34:36 -0700 (PDT) Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4RGXl92DZNz9sSv; Thu, 3 Aug 2023 04:25:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cyphar.com; s=MBO0001; t=1691029557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QDaQQq8N3pV/0zOSm0S8Jmeu7eQz2E5FW0Ju7kYcogY=; b=Y1QMaVE0KtysYE+lwk1MnyWvrQxXJS9qbQlv2SuhvCeiQhrJnugZ6PyoP5TdBjHVlcHA6W 61Z7A2b1SDPlD6gmsQsoVh91sHohyYVSGA5TZzJDK/nOlqlfcbPORdD0H9pCU8B35nG2WA Yv4yh7KeNg7PI59PogMuBQvzEGr/M7xCPzPM6t8yBxr3nKcnRIShRimmUiAbhNgukDtjkH 92zM38Uv9/yEiWW+aEpxEHex3y3BnhkcH4qsf65XwM0y6Mu/2fwRPGa63Dzox9sZKLyo6V LFZjG+/BfNweZpbLMGAt61Fl8isAN0qJHseIuhGyUKmmJOsKqBiC9nNnHTD1qA== Date: Thu, 3 Aug 2023 12:25:42 +1000 From: Aleksa Sarai To: Jeff Xu Cc: Shuah Khan , Andrew Morton , Daniel Verkamp , Kees Cook , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 3/3] selftests: memfd: error out test process when child test fails Message-ID: <20230803.022458-mundane.voyage.tricky.kinship-yaSxczr9O6cB@cyphar.com> References: <20230713143406.14342-1-cyphar@cyphar.com> <20230713143406.14342-4-cyphar@cyphar.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ol7adjwswqudaxv6" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 --ol7adjwswqudaxv6 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 MF= D_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/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 fl= ags, 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 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 Did you mean for this to a Reviewed-by? --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --ol7adjwswqudaxv6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQS2TklVsp+j1GPyqQYol/rSt+lEbwUCZMsQJgAKCRAol/rSt+lE b6fuAP9ki0uOZxhvg7UYVxVmtgV9baTK8Br1vb4etGtmEfZ1IwEAg8kjMvzzv+mb zmU0bhe6uOd5ZHdu5KCubvPCLtWzow0= =mmRd -----END PGP SIGNATURE----- --ol7adjwswqudaxv6--