Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp873070ybi; Fri, 21 Jun 2019 09:33:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAgfkIaw1JfInbUk04FO4EzyTcaDK58V1GfiFoGt9UkVPipQrn6RYvQKnOFOPPQYirWtEJ X-Received: by 2002:a17:90a:2224:: with SMTP id c33mr7787858pje.22.1561134823591; Fri, 21 Jun 2019 09:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561134823; cv=none; d=google.com; s=arc-20160816; b=1LRb8G422k55WhHmKIi9voL35y5b+bArEmLbCWW8zxwUVSCp59NWDURCi7+895uti7 2SUjxa4nPBARCCutWHSHXrLJL8jAOWGN2rGUlgK7FVg4R3OQ6+0wFhH6cRO8EDLXvRSL o8jaEjTHfepWFtTxIB+6RYH62iCICqQ8qr9Y3SGVzJgd5WioWEYyzQ6paujRfC+yAoY6 NTbrMTxO+N28WcTJ3RSWccbV4eKiOgu8spCyz+bgllqgXrkiDnSqlCnzhRsgdEUBWES3 QhBXlZq7m9HjUJsgcq6lSs7sTIIE/otLLtHPhPHhC4jqTh8FbVMJFj6XkULupNwwGNXg Kuvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=aSdBckegFzQEjYX7ZiMJd7mt9WUZwn5okSTm10WY7LM=; b=IBjaF2bmduyI6rwy9tgb9ZClU1dzE6uS19zm2PRsc7fveA5zioaAjbSCWQ7mPhDB0q 3wW99QgnYLCNZhQFkBuBKNXYW9ukQ23XWl2y5Pg1ucofN1lvHLcftr6UJrIlHkYstYfy iWjSmchw8xHWqa2t5SGu3ehYuBeCQmZ0zawfApBoOL8gvJRxqwdsP2OpyWyFPORA1ikq RqGPBBKT9fP/SNxvgMI707uNcj0IgeDGYJ6r/oHfxbIVfpAEIeKf3Oea1Hr9cId2lzg9 q7bd9hzLlUiJxSEIhxg+W/+1Qv2G0ctVnbizZzF5R2Ng7a0yS0TTWfUwSndK0kI4ejkW CqIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A1apq8T8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id j17si3118309pfa.198.2019.06.21.09.33.28; Fri, 21 Jun 2019 09:33:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A1apq8T8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726112AbfFUQby (ORCPT + 99 others); Fri, 21 Jun 2019 12:31:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:58258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726002AbfFUQbx (ORCPT ); Fri, 21 Jun 2019 12:31:53 -0400 Received: from linux-8ccs (ip5f5adbc0.dynamic.kabel-deutschland.de [95.90.219.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3874620673; Fri, 21 Jun 2019 16:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561134712; bh=UcfMc1ASXqklmAnizKrMCBrZWJYP/6BAOOe+TG0bhw0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A1apq8T89fxZZBpaF4gUEZnjgdRJBnuMF9uzm5yssy3csi3d7C2kVFecBOXZhe814 ATVGIVhR1TWYc0fxr6FehNFsGqL/LLXLLVYfpqqvcydjYN6XKNjUzJafFSpiRdDsH/ mwWUIA1zZzBEPGRS3ScUA1m811gq4zGarY56MZAo= Date: Fri, 21 Jun 2019 18:31:46 +0200 From: Jessica Yu To: Peter Zijlstra Cc: Miroslav Benes , linux-kernel@vger.kernel.org, jpoimboe@redhat.com, jikos@kernel.org, pmladek@suse.com, rostedt@goodmis.org, ast@kernel.org, daniel@iogearbox.net Subject: Re: [RFC][PATCH] module: Propagate MODULE_STATE_COMING notifier errors Message-ID: <20190621163146.GB24038@linux-8ccs> References: <20190617090335.GX3436@hirez.programming.kicks-ass.net> <20190619112350.GN3419@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190619112350.GN3419@hirez.programming.kicks-ass.net> X-OS: Linux linux-8ccs 5.1.0-rc1-lp150.12.28-default+ x86_64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +++ Peter Zijlstra [19/06/19 13:23 +0200]: >On Wed, Jun 19, 2019 at 01:12:12PM +0200, Miroslav Benes wrote: >> > @@ -3780,7 +3781,7 @@ static int load_module(struct load_info *info, const char __user *uargs, >> > >> > err = prepare_coming_module(mod); >> > if (err) >> > - goto bug_cleanup; >> > + goto coming_cleanup; >> >> Not good. klp_module_going() is not prepared to be called without >> klp_module_coming() succeeding. "Funny" things might happen. > >Bah, I did look at that but failed to spot it :/ > >> So it calls for more fine-grained error handling. > >Another approach that I considered was trying to re-iterate the notifier >list up until the point we got, but that was fairly non-trivial and >needed changes to the notifier crud itself. > >I'll try again. Hm.. I would prefer if we didn't complicate the error handling too much, especially since you mention it seems non-trivial, and it doesn't look too nice. You also checked that calling the GOING without the COMING notifiers should be safe, so I think we can keep things simple. I tried to look at how other places in the kernel handle blocking_notifier_call_chain() errors and the places that do look at the error code (most invocations of blocking_notifier_call_chain() seem to just ignore the return value) just call the opposing notifiers (module "going" in our case) to cleanup. I also would not mind breaking up prepare_coming_module() to refine the error handling, as I mentioned in my other mail. Thanks, Jessica