Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp28945081rwd; Wed, 5 Jul 2023 05:11:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlEwrCh4h3SgnPJrUsmFWDcVyuQ3++KpGE45NwYyBf1n42pVJEafd0abJXKilMoHebAYdNcF X-Received: by 2002:a05:6871:84c8:b0:1b0:151c:9b19 with SMTP id sw8-20020a05687184c800b001b0151c9b19mr14644036oab.18.1688559089791; Wed, 05 Jul 2023 05:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688559089; cv=none; d=google.com; s=arc-20160816; b=AbFNYC/GtP1b++f8b5n5Pzw+lqzAEOD2d6WqbUT/EhGMYRK9WKUT2pcAC9EOeEp6Dd seB/8tuw+XC7vVzXMkLXlcd58aTaIPCdqquIuy/5FyHazc+1uqNjMnZKKfhNL2+fuI2C 0vz4KvKVvyj0AJGQjia/TLqbdBy4fFQBVa5jDhmRXpH28kRY1mK5+gUCfOaiXFoF0+mS JrgMlxzVr9SLhPsmzsAesZr/drD07VW0VbUGgZRNpokDmiCt16aKUQYIW2pG6sQrPRdh v8DFD4y/hJnnNjSk3av15YzN6wG+SSD+7NnzHlovblH7DRo7rZMWsgZLnUlTeERdxKG8 HnbQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=vfR8/ZSX0/D6M8s9Gj9d1Mbb5rBuYKNTQrlLB2P7y0c=; fh=LhqOoylnRJGkMQ1zYvu1iDNMEIuWNfCET5IbaSkbBb8=; b=LWmrh2JQ+VVAbuVLn2dUC6BU2NnC+LdyekQANhsZIy+I0Dlb+dVX2rgDsmDCx0SEu4 aBYYLkT4AMJC1sQhyWKjZlArZDD2Zdx2pta0PaOdT3yeqWIHEb6ihBPVh6hkJk+uwmak a2Oxunu2tvvYKnzcvrHexM89Nq3qepuJmZKTeR+badaEogdL9+tN6CC4DdA3VSZI6tT+ 5cIev1Vbkz8AO6zU/4/uEBBr1zU+pxUMRbrhrz0fKtb8a6xqol5+LDjE391Gq0+beYWL n39307F5BZXuxKgx5mEa0G+djxWEp9oUO7nsO4XKuh6zHVRzgW9XtqpXOuP1U/VFQ4oa wnKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gQbr81r4; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d3-20020a17090a8d8300b0025ea4ae2799si1461211pjo.19.2023.07.05.05.11.12; Wed, 05 Jul 2023 05:11:29 -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=@kernel.org header.s=k20201202 header.b=gQbr81r4; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231787AbjGELxp (ORCPT + 99 others); Wed, 5 Jul 2023 07:53:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbjGELxo (ORCPT ); Wed, 5 Jul 2023 07:53:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B848A1; Wed, 5 Jul 2023 04:53:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 33CCD6150F; Wed, 5 Jul 2023 11:53:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94540C433C7; Wed, 5 Jul 2023 11:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688558002; bh=ieO2X/lBi2r10eqVd5hEK+hSNE8vmZv8+Pqsk4DwJpM=; h=From:To:Cc:Subject:Date:From; b=gQbr81r4/R+ddRIVgmE0eAMEoagIJLFIX/cjIvoNiy+BHkOfX9g/DqXPDJs5WgKQ5 mqEMTePBQEugZobzXpsEOWAUs4s0uMc/ZTvfK1DSt/K3UZ+dpetvaskhUjLhDVkh4h G7vElXTvtboFmjT/+dRKu392wcxUMv3FbCjL8rllPFjlRm5RCcB76a6LlkFEESn4bK lJ4C+BvPwEZQJtjURFUCZ84HNsCByMtWqHYWZU5FoJhLHJiCBh3oPVxNgFXF7MKYgs NgU4mhEy/5RPVUlBoElbtyXe7z+THStzPCNIJfIVMz7bNE2I8HA9Yfrze6rMdbxKOx 1Ubm8Txt+ci7g== From: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= To: Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Andrea Righi , Kees Cook , Mirsad Goran Todorovac , netdev@vger.kernel.org Subject: [PATCH] kselftest/runner.sh: Propagate SIGTERM to runner child Date: Wed, 5 Jul 2023 13:53:17 +0200 Message-Id: <20230705115317.753182-1-bjorn@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 From: Björn Töpel Timeouts in kselftest are done using the "timeout" command with the "--foreground" option. Without the "foreground" option, it is not possible for a user to cancel the runner using SIGINT, because the signal is not propagated to timeout which is running in a different process group. The "forground" options places the timeout in the same process group as its parent, but only sends the SIGTERM (on timeout) signal to the forked process. Unfortunately, this does not play nice with all kselftests, e.g. "net:fcnal-test.sh", where the child processes will linger because timeout does not send SIGTERM to the group. Some users have noted these hangs [1]. Fix this by nesting the timeout with an additional timeout without the foreground option. Link: https://lore.kernel.org/all/7650b2eb-0aee-a2b0-2e64-c9bc63210f67@alu.unizg.hr/ # [1] Fixes: 651e0d881461 ("kselftest/runner: allow to properly deliver signals to tests") Signed-off-by: Björn Töpel --- tools/testing/selftests/kselftest/runner.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh index 1c952d1401d4..70e0a465e30d 100644 --- a/tools/testing/selftests/kselftest/runner.sh +++ b/tools/testing/selftests/kselftest/runner.sh @@ -36,7 +36,8 @@ tap_timeout() { # Make sure tests will time out if utility is available. if [ -x /usr/bin/timeout ] ; then - /usr/bin/timeout --foreground "$kselftest_timeout" $1 + /usr/bin/timeout --foreground "$kselftest_timeout" \ + /usr/bin/timeout "$kselftest_timeout" $1 else $1 fi base-commit: d528014517f2b0531862c02865b9d4c908019dc4 -- 2.39.2