X-Received: by 2002:a17:90a:a382:b0:1bc:202a:28e8 with SMTP id x2-20020a17090aa38200b001bc202a28e8mr2450785pjp.131.1645508244832; Mon, 21 Feb 2022 21:37:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645508244; cv=none; d=google.com; s=arc-20160816; b=g7wdF8YuuWmdvbx+tWxQVYdVv0Gf1kxeE29SjzaWm/2OGygkd8zc+wXanbiatl/jx3 LJZFQI8YFTnUzCkBavPOL74CQaegSjy2r27WNn2rE9bq8sH1OerDLn5Lp2utmNHYA7nb MLLosXNCUNCwGYAxeg2MPNJKV/neo9/oQNe0qpq3Q/G5XoNir/l03aq3O8RKhR9wXjUM KU8LYVHcgpfo9HQ3htU7hmA9S2kewuzq05zzmcQVV4Lv1CiL455YX4s8OP54/n+RS3xd oELgssl79ORrrpfsUFQVXA6rss8v0RoXTP2sDGDnvwqK7BMNu9YUuf+U1N9S2Wk2SFSe zxAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BY50qvbr2cdPi8liUhF1+Uk1z6aeT99T+3MzUdjFqcQ=; b=c3svLXi/AzVbhiW32i0il5TMuIXWHZRss0101lrBxwigMcyJdJ0PRJbpRlrVXsqNpx XNXfGWYlQhnYmS8A+7ppN0HJzUBi29uslBeXDVy4yzF5/VECVxzbeRBsyQ+m1gZ2u9f0 Rtud6JDxiQLdLaSfhT/zOXpcveZITvOL3gVfj8sIwCupdGQN+nycLrKZYA2r93ZnNHlw uimpimINK8LS7ErMo+HS/K4UmDgxBWgiIXw+ByBMVuDZ6zp75NOe/XA5DgW8eMAAqCCR ZNSjzb4YBVQUlBa6izYjscbkz8M8R3F7K6KM/RprN+8pwcNqPNBxbS+9r7HOTXiu8Aer KIFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zF3ob41/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j7si1151977pjc.34.2022.02.21.21.37.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:37:24 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zF3ob41/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A14A09399C; Mon, 21 Feb 2022 21:04:46 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351425AbiBUJsx (ORCPT + 99 others); Mon, 21 Feb 2022 04:48:53 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351362AbiBUJn7 (ORCPT ); Mon, 21 Feb 2022 04:43:59 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55ED83EF23; Mon, 21 Feb 2022 01:18:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D6980CE0E76; Mon, 21 Feb 2022 09:18:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B870BC340EB; Mon, 21 Feb 2022 09:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645435083; bh=qpKXmq3SY6mhExkKTzKyH2WV4QpU0WkZoSqvrwQR5fc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zF3ob41/I2vJcjjeqpDfEAVASKWPESSDt8rKc1yj3jDz8I6Nwa8xC+FbwvEJZRhRm rrAsZQAFWWaD9mipF2XgSaME1+gek8a3534JfMhXakKVqC3zGzMiUZNh9TeXAIIWbP KKUiQIPBREiSfHASSSFnemvooCz7e6WiLiPEuByg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, yang xu , Li Zhijian , Christian Brauner , Shuah Khan , Sasha Levin Subject: [PATCH 5.16 037/227] kselftest: signal all child processes Date: Mon, 21 Feb 2022 09:47:36 +0100 Message-Id: <20220221084936.096976076@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084934.836145070@linuxfoundation.org> References: <20220221084934.836145070@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Li Zhijian [ Upstream commit 92d25637a3a45904292c93f1863c6bbda4e3e38f ] We have some many cases that will create child process as well, such as pidfd_wait. Previously, we will signal/kill the parent process when it is time out, but this signal will not be sent to its child process. In such case, if child process doesn't terminate itself, ksefltest framework will hang forever. Here we group all its child processes so that kill() can signal all of them in timeout. Fixed change log: Shuah Khan Suggested-by: yang xu Signed-off-by: Li Zhijian Acked-by: Christian Brauner Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/kselftest_harness.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h index 79a182cfa43ad..78e59620d28de 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -875,7 +875,8 @@ static void __timeout_handler(int sig, siginfo_t *info, void *ucontext) } t->timed_out = true; - kill(t->pid, SIGKILL); + // signal process group + kill(-(t->pid), SIGKILL); } void __wait_for_test(struct __test_metadata *t) @@ -985,6 +986,7 @@ void __run_test(struct __fixture_metadata *f, ksft_print_msg("ERROR SPAWNING TEST CHILD\n"); t->passed = 0; } else if (t->pid == 0) { + setpgrp(); t->fn(t, variant); if (t->skip) _exit(255); -- 2.34.1