Received: by 2002:a05:7412:a9a3:b0:f9:327e:43ab with SMTP id o35csp70348rdh; Mon, 18 Dec 2023 04:50:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmQrV8l240G0OyDO710bvGo4L4nD5pHNPEs6pG6JV5HS66P12Mlkd7JT+GLTlrMMhF6hAa X-Received: by 2002:a81:df0b:0:b0:5de:7455:1a06 with SMTP id c11-20020a81df0b000000b005de74551a06mr13529673ywn.21.1702903814835; Mon, 18 Dec 2023 04:50:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702903814; cv=none; d=google.com; s=arc-20160816; b=sAWa0g9ouK4o5qn7hrwWUyajjrlA9EARtHIyP/o2RvUwVjs25csUuUixfWspEFwRdk B6BWe8GM4fz819STeaQj2/C0JDGBWgVIbxFl7nxnrHE3klODQjix8wgWHKuJGtUCJD5M JrBPZz3D6qIF0g0+U1NEgDdE8vjOmh+1FQx88+7ceMiDOfRb2niHs3skK1yBOyZ4on9n KX3xzWmCI8mqoFIAD5lTAIGZw46jHX+BVqTnEA2bcPi6Jz5XJT6CeDjly6348PbfnUSX wAo0NXZtbSrzv/LDcDLNWUj/9puRufGqmFjYr6LGY+y/SLANKVP/K+m+Gnnc1iwVryl5 zz0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iR1DRNU28LrfgMqjMf7r/So0m5BOuithKj+7p0gQv6w=; fh=P+ljZgjtlgCphSWNS/IdevCPcefD/jAa3nOBAPNdUsk=; b=IFPxCYaZOa5hkKoonB06/wXFivYTFnkdEgx0UeunLgs2YaPQLluj5Yb+39xvRcYOCH Biz3VQnrZY7IWj1Vi9pYuQMLVEq44OpFVwkpRwnMJCPzsqvqBciYnhc2s5p39HKm0XRv 4cfXtUa+kgeoyGn3e94D0D/QdBluldzoHTPjZyMG9DILk1pNUZWg0OoHwLLqKetKFOTI Cx/kx3gXrNwfGfO6NWI60IQ1dYf+rKJThgwg9+MVk2P0GIk4z5Zkk4zxs1z2yjOl639S C1ndYWlP4NDphu8LW92iCVMWGGTcZ/LlLoRuqGKbmWKTCxIph5y/ioGUE1gi8V3rQJTs Exow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Fdsnd/R+"; spf=pass (google.com: domain of linux-kernel+bounces-3616-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3616-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h27-20020a05620a10bb00b0077fad9ed4a0si7855109qkk.13.2023.12.18.04.50.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 04:50:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3616-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Fdsnd/R+"; spf=pass (google.com: domain of linux-kernel+bounces-3616-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3616-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 93DFE1C244B1 for ; Mon, 18 Dec 2023 12:50:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BACE242395; Mon, 18 Dec 2023 12:44:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Fdsnd/R+" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AACCB4237D; Mon, 18 Dec 2023 12:44:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16894C433CA; Mon, 18 Dec 2023 12:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702903497; bh=FA7bC/Tz22mCuz19J7PFs++xTkp+j/DZIFm/pULGGl0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Fdsnd/R+4UyNhga0DfAdvjbrWZezQ0FT1GzT8s+S7SlcxFsgX1mKGoN9yh5NHcYkm JNt65swmHeDRpnVHlAPgjUltjxLZRsIbBSLKQ4e4Add2aZtW+ZbBSVRGKTD1RE5+lR 0ZFwok+z2pABDWQSIXNVrTYxO3b7KSNkp580lMxU= Date: Mon, 18 Dec 2023 13:44:54 +0100 From: Greg Kroah-Hartman To: =?utf-8?B?VG9tw6HFoSBNdWRydcWIa2E=?= Cc: Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH] /proc/sysrq-trigger can now pause processing for one second Message-ID: <2023121858-detonator-deepness-0135@gregkh> References: <20231218114222.283705-1-tomas.mudrunka@gmail.com> <2023121858-aground-consent-cfe3@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Dec 18, 2023 at 01:37:44PM +0100, Tomáš Mudruňka wrote: > > What will kill it? I feel like you are adding features to the kernel > > that can be done in userspace, which is generally not a good idea. > > The mere act of writing "e" to /proc/sysrq-trigger kills everything > except for init, which is rather unfortunate when doing that through > remote access, like ssh (or other). I can surely block SIGTERM in > userspace by fixing all remote access software that exists to not exit > after SIGTERM, but if i want to do SIGKILL and then execute few more > sysrq actions (sync, unmount, reboot, ...) it surely is a problem > unless i am doing this from init process. which sometimes is just not > possible on remote system that have undergone some crash. and as linux > admin with 13 years of experience i can safely say that situations > with unresponsive init do happen every now and then. that is when i > usually have to resort to rebooting the system remotely via > sysrq-trigger. this process failing can be difference between me being > able to fix issue remotely with minimum downtime and me having to > physicaly visit datacenter during holidays. > > BTW if still unclear, here is simple example of how running that > suggested code will not work: > > $ ssh root@10.10.10.10 > root@10.10.10.10's password: > Last login: Wed Oct 4 12:34:03 2023 > root@debian-arm64:~# > root@debian-arm64:~# echo e > /proc/sysrq-trigger > Connection to 10.10.10.10 closed by remote host. > Connection to 10.10.10.10 closed. Great, then perhaps sysrq is not the thing you should be doing here? Why is sysrq suddenly responsible for remote connection fixes? I'm all for adding stuff that is useful, but really, sysrq is a "last possible chance" type of thing, if you need it to reboot your box, your box is hosed and it's not here to make it any less hosed. Add pauses and soon you will want loops and then it's turing complete :) Why not have a bpf script that does this instead? :) thanks, greg k-h