Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1970414rdb; Mon, 9 Oct 2023 08:31:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSLmd/sbOZGWxkRmKxiqr8Yj+Kv36C8j90VQD+Z1YcyS/chkI3wvgPPCah/gzkptUmJjEI X-Received: by 2002:a05:6e02:20eb:b0:351:4ee8:c914 with SMTP id q11-20020a056e0220eb00b003514ee8c914mr18851977ilv.14.1696865466432; Mon, 09 Oct 2023 08:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696865466; cv=none; d=google.com; s=arc-20160816; b=tBaKmy8N/C8FkEMlb17f4L/YLGdw5ua0HNJHs8n/n8KRjyMal6LuiB3LikA484+58p uEqbyaXkx37VHqw1l4C9LWtslQ9beE587b9funOYUheKr/vOB780RMWB2nx39ktfG2ax GQQrl6wiTJpWc8HyfjrSiFK77BfV+BglZSPJwa0G0zvB0jm1xk5x+OZ7e2jPI5YB8UZ4 pn0VX3xKg4NWiqvnfIMOOg1IJlEI29RzZbJjEHpZqPcE+a2N1F2nrwFqbWzUw/nuDQ0f dzHdApZmaKSF9roGbdmm+IYKc1mZ0CoGE968a2kd5zzJTquUrDoebE91Jit4J3YnIF+I PY1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :user-agent:message-id:in-reply-to:date:references:cc:to:from; bh=FTaM0w3vEQj3N6BqqcF22zH3/8LCq1JNMxe06FimRds=; fh=vKk1zRbemeB5dZYBHgLwmxhbLKxTAqSNrVC4Jf6qi5I=; b=VXwis2GepCd6EikDTIOD5JJkB9DsK0CUaGZ0hELBCB1UGf4Uza4ijhp8oG1ZqCKCM1 yuTq1sBKUmWg+LKtAwgP3bTZwZmBaz0+pjP0Rg94sdC5zOdmUFXIckNJQaoKt97dUTlO xa/mXYwtnlk2svrIO3RiZwpQoulAYEtozXOq6n7Si3OnrXQUDg82tQvG/KpxF2oiA32i CXMsj+gQxZrsa9ih/9LHqcGwuaYNrExE14KvhU/EHdlPMmS53I8nsjLCG4RAmSuZ+HYm Uy6QPrCI2jklxSxEtzocWVz+GI7xPVGHXXuhl/vM6s23oy0kmWY1BmBjyUBQssE5snCM NrkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id q21-20020a635055000000b00580e32f778csi2988872pgl.506.2023.10.09.08.31.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 08:31:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 31DAD80FC167; Mon, 9 Oct 2023 08:31:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376553AbjJIPau convert rfc822-to-8bit (ORCPT + 99 others); Mon, 9 Oct 2023 11:30:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376424AbjJIPat (ORCPT ); Mon, 9 Oct 2023 11:30:49 -0400 Received: from out01.mta.xmission.com (out01.mta.xmission.com [166.70.13.231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49EB2A3 for ; Mon, 9 Oct 2023 08:30:47 -0700 (PDT) Received: from in01.mta.xmission.com ([166.70.13.51]:38198) by out01.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1qpsDU-0060Yb-3i; Mon, 09 Oct 2023 09:30:44 -0600 Received: from ip68-227-168-167.om.om.cox.net ([68.227.168.167]:38624 helo=email.froward.int.ebiederm.org.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1qpsDQ-007a4Q-RL; Mon, 09 Oct 2023 09:30:43 -0600 From: "Eric W. Biederman" To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, Steven Rostedt , Ricardo Ribalda , Ross Zwisler , Rob Clark , Linus Torvalds , kexec@lists.infradead.org References: <20230929021213.2364883-1-joel@joelfernandes.org> <87bkdl55qm.fsf@email.froward.int.ebiederm.org> Date: Mon, 09 Oct 2023 10:21:04 -0500 In-Reply-To: (Joel Fernandes's message of "Sat, 7 Oct 2023 21:30:42 -0400") Message-ID: <87il7fzusf.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-XM-SPF: eid=1qpsDQ-007a4Q-RL;;;mid=<87il7fzusf.fsf@email.froward.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.227.168.167;;;frm=ebiederm@xmission.com;;;spf=pass X-XM-AID: U2FsdGVkX1/05uh69me2MdpVapboGWSZ9mJiUasho74= X-SA-Exim-Connect-IP: 68.227.168.167 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-Spam-Level: X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Joel Fernandes X-Spam-Relay-Country: X-Spam-Timing: total 2656 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 12 (0.4%), b_tie_ro: 10 (0.4%), parse: 1.77 (0.1%), extract_message_metadata: 23 (0.9%), get_uri_detail_list: 3.0 (0.1%), tests_pri_-2000: 7 (0.3%), tests_pri_-1000: 3.7 (0.1%), tests_pri_-950: 1.83 (0.1%), tests_pri_-900: 1.44 (0.1%), tests_pri_-200: 1.19 (0.0%), tests_pri_-100: 4.7 (0.2%), tests_pri_-90: 2370 (89.2%), check_bayes: 2360 (88.9%), b_tokenize: 9 (0.3%), b_tok_get_all: 8 (0.3%), b_comp_prob: 3.0 (0.1%), b_tok_touch_all: 2336 (88.0%), b_finish: 1.19 (0.0%), tests_pri_0: 215 (8.1%), check_dkim_signature: 0.56 (0.0%), check_dkim_adsp: 4.1 (0.2%), poll_dns_idle: 0.40 (0.0%), tests_pri_10: 2.0 (0.1%), tests_pri_500: 7 (0.3%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] kexec: Fix reboot race during device_shutdown() X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 09 Oct 2023 08:31:03 -0700 (PDT) X-Spam-Level: ** Joel Fernandes writes: > On Mon, Oct 2, 2023 at 2:18 PM Joel Fernandes wrote: > [..] >> > > Such freezing is already being done if kernel supports KEXEC_JUMP and >> > > kexec_image->preserve_context is true. However, doing it if either of these are >> > > not true prevents crashes/races. >> > >> > The KEXEC_JUMP case is something else entirely. It is supposed to work >> > like suspend to RAM. Maybe reboot should as well, but I am >> > uncomfortable making a generic device fix kexec specific. >> >> I see your point of view. I think regular reboot should also be fixed >> to avoid similar crash possibilities. I am happy to make a change for >> that similar to this patch if we want to proceed that way. >> >> Thoughts? > > Just checking how we want to proceed, is the consensus that we should > prevent kernel crashes without relying on userspace stopping all > processes? Should we fix regular reboot syscall as well and not just > kexec reboot? It just occurred to me there is something very fishy about all of this. What userspace do you have using kexec (not kexec on panic) that doesn't preform the same userspace shutdown as a normal reboot? Quite frankly such a userspace is buggy, and arguably that is where you should start fixing things. That way you can get the orderly shutdown of userspace daemons/services along with an orderly shutdown of everything the kernel is responsible for. At the kernel level a kexec reboot and a normal reboot have been deliberately kept as close as possible. Which is why I say we should fix it in reboot. Eric