Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5458331pxu; Tue, 22 Dec 2020 18:40:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxi5mE5G1sZNju/oqb70N2Kx4fnDJjcv2HW+PrducwcaO9G2H6KOXdXVA9ihLS7MqYhaTzc X-Received: by 2002:a17:906:7d98:: with SMTP id v24mr22372651ejo.129.1608691255129; Tue, 22 Dec 2020 18:40:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608691255; cv=none; d=google.com; s=arc-20160816; b=BdOD9pMQrJETga1UStZG/N3Fuwfe1KJHy06QMWEQV7NltUyKdoIGXwr07FcKz7DVDy lCAhef6MtPLj/bsd6V8cK0llRdi6rxkHNPcvjkV9i4jaupc9IBB6Fb72SwGuUY/yjkLU 1LBkefZBQ988VN5IzTxKbkxPEUJsukTP23m4Q3VsdVEbvWy6aGPvLsos+8g/PeqIfYl+ PZLt6QQc30/jlzJvekCvwR4VpU/dT1cQqtfPJoex02z2iEXmhtxhQ96xAPCkjB65G4Fc 522IS67LBuLpuWYGFKlGagiVgIIr6v2PyEs38cuWk5efyyS8rr8+ch4VLn0WoXUwkvp+ g0dw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=x41vhKFQV3NnjM/14emJFdKfAUrm3T6/AYvt40MRLtg=; b=YTezlOYgkfkxyiW3X/nN/Ow0Mw9gpVgOQhd9uVVFHOFLAhWEHD+DoyXtw5bcmejt6X 10GBe0sqaa98Y5qikCl/D06Demij53IdepCk9melAG5+B/GNUVVmut5fYdRJpssx4p3P qEzbxNskIGueA2H+WC+e0bIQoS2v1hHe9biR9G+aB244HuOt2w/Zq+VEcW+PXtyKGPdT tYt6/089IX9QGmFGnRIEx8CAHwAGy5KSSW4qquRgkUzqkp1Qv3dDBGrByQWukueRQOmR FLvylO0S9ym07f2lReDHPCIp4i9I/k04w3nkKu+1ZRjpf/lLmOYTQpeCM0131B+32aal NRvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IZ1CDAT7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si3951970edb.68.2020.12.22.18.40.32; Tue, 22 Dec 2020 18:40:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IZ1CDAT7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730017AbgLWCXg (ORCPT + 99 others); Tue, 22 Dec 2020 21:23:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:52102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728174AbgLWCX0 (ORCPT ); Tue, 22 Dec 2020 21:23:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4B10723359; Wed, 23 Dec 2020 02:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608690186; bh=goaIIuZKrLNP7nxSPkB+ROf/ExZZq/+Rhxm/cQUuscU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IZ1CDAT7+9ApSQAfGcE5UfWkwm//gNuhPTeS70V5Og6bCV8oRjRHTnI9ATOFIX1vI PcjvwW9Hv5ymCS8iZOZ9BGn5bwyC/ZgAhqViOU9DobcwKEnQMjs74sTtjUivuklAJc A8XKtYg0lPCJeeRnsxxwXWniOeyJh3Zln8o+RJ8XnDOQCkxoi/Qh/sSWJBOJ8sEtRn 8d0VUEHU2Y1LKiGzGO3DBqYwRtxuBya0j2x18znqkDdy0tqVYZphMfU+Y/68iQlnjM Ub/bhgjB26fqAhK4LPZHhb352Om8sb8Y26/d2s5wBF+5o2YsLW8tng+9GoLCCvlUaE YQx5SDk0BZMDg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Paul E. McKenney" , Sasha Levin Subject: [PATCH AUTOSEL 4.14 11/66] locktorture: Prevent hangs for invalid arguments Date: Tue, 22 Dec 2020 21:21:57 -0500 Message-Id: <20201223022253.2793452-11-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201223022253.2793452-1-sashal@kernel.org> References: <20201223022253.2793452-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Paul E. McKenney" [ Upstream commit 6b74fa0a776e3715d385b23d29db469179c825b0 ] If an locktorture torture-test run is given a bad kvm.sh argument, the test will complain to the console, which is good. What is bad is that from the user's perspective, it will just hang for the time specified by the --duration argument. This commit therefore forces an immediate kernel shutdown if a lock_torture_init()-time error occurs, thus avoiding the appearance of a hang. It also forces a console splat in this case to clearly indicate the presence of an error. Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/locking/locktorture.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index 032868be32594..5b9fde4432cfe 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -40,6 +40,7 @@ #include #include #include +#include MODULE_LICENSE("GPL"); MODULE_AUTHOR("Paul E. McKenney "); @@ -1062,6 +1063,10 @@ static int __init lock_torture_init(void) unwind: torture_init_end(); lock_torture_cleanup(); + if (shutdown_secs) { + WARN_ON(!IS_MODULE(CONFIG_LOCK_TORTURE_TEST)); + kernel_power_off(); + } return firsterr; } -- 2.27.0