Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2407536ybb; Fri, 27 Mar 2020 05:05:25 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtwWzpextEM3HL3M9y0cRraW9M4ZzJr0YLEd93Dk16re+rUaErAS5RAZCBKvj069Z3twgLu X-Received: by 2002:a05:6830:1e10:: with SMTP id s16mr10001257otr.222.1585310725660; Fri, 27 Mar 2020 05:05:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585310725; cv=none; d=google.com; s=arc-20160816; b=A+TfDqYx7cCoYEaYFFrd5ElHOroHVmrxODpsHSF0lj7HSR7uHN/9sXqCdRg04yVtaQ xlV7Gh+79RRrgoi+pGRpMwPxwZ50grjk+goGM88hiLucAgzxDAO8PhvaQQzsSqVlvNqA EcYg/qqYT2maCMl+yPF8VWYft/YDnAVusW5PJFGaCxyN+DO+IKuuF1jPpy8sXwiiN0Vn 1V3Lga+QB4owDjNlQldLfr04/E67ghmi8Vc009eiTBZM+fi4av8r02wjyUarVRj6/sGF wF4bOTbPltjDcHMd462Kof8xYVOtgC+l92jeGlhjCbMKDxTvAjxdnMHY5UgmrF0slnIt uD4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=TffwKlU9KNpb7nd8FVSGtv8KnK7EoeAB0LZzEmmly7w=; b=m7/TUiTvzbPgSi/u7ljUCJ/jQZyAiMZQ7Y4NmpYtJg21wueushKwvUWQYQytqRdOt/ 6XfvE7oFMm24Kotmf6eUNVav4JlsH+o/PwU2VQ5EwrQNIU/AJBRH9+i/KMYCmsBCmbJx 8CLDZCd0mPs1GwgyiDo+eblqgFD7mS1POpp9isgLNP6729OGPQzo7aBLMmrUYGZcM1IQ mlLqONtjVsLjSRFOlqjE0/pokznBzxnh+P/HvZNq5L9WkEMHKuo3TS5peZMjeq0TiAcw Y6y0g1NnWGXLh56+XOJ7W1evfunuParfpj6SsXkbrZTIfTxrz3ZMOdicBnkDo7VrFw0q q01Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k39si861372otk.255.2020.03.27.05.05.09; Fri, 27 Mar 2020 05:05:25 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726758AbgC0MEs (ORCPT + 99 others); Fri, 27 Mar 2020 08:04:48 -0400 Received: from mx2.suse.de ([195.135.220.15]:35368 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbgC0MEs (ORCPT ); Fri, 27 Mar 2020 08:04:48 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C3F8FAE2B; Fri, 27 Mar 2020 12:04:45 +0000 (UTC) Date: Fri, 27 Mar 2020 13:04:44 +0100 (CET) From: Miroslav Benes To: Jessica Yu cc: Peter Zijlstra , x86@kernel.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, bristot@redhat.com, jbaron@akamai.com, torvalds@linux-foundation.org, tglx@linutronix.de, mingo@kernel.org, namit@vmware.com, hpa@zytor.com, luto@kernel.org, ard.biesheuvel@linaro.org, jpoimboe@redhat.com Subject: Re: [RESEND][PATCH v3 03/17] module: Properly propagate MODULE_STATE_COMING failure In-Reply-To: <20200325173519.GA5415@linux-8ccs> Message-ID: References: <20200324135603.483964896@infradead.org> <20200324142245.445253190@infradead.org> <20200325173519.GA5415@linux-8ccs> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Mar 2020, Jessica Yu wrote: > +++ Peter Zijlstra [24/03/20 14:56 +0100]: > >Now that notifiers got unbroken; use the proper interface to handle > >notifier errors and propagate them. > > > >There were already MODULE_STATE_COMING notifiers that failed; notably: > > > > - jump_label_module_notifier() > > - tracepoint_module_notify() > > - bpf_event_notify() > > > >By propagating this error, we fix those users. > > > >Signed-off-by: Peter Zijlstra (Intel) > >Cc: jeyu@kernel.org > >--- > > kernel/module.c | 10 +++++++--- > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > >--- a/kernel/module.c > >+++ b/kernel/module.c > >@@ -3751,9 +3751,13 @@ static int prepare_coming_module(struct > > if (err) > > return err; > > > >- blocking_notifier_call_chain(&module_notify_list, > >- MODULE_STATE_COMING, mod); > >- return 0; > >+ err = blocking_notifier_call_chain_robust(&module_notify_list, > >+ MODULE_STATE_COMING, MODULE_STATE_GOING, mod); > >+ err = notifier_to_errno(err); > >+ if (err) > >+ klp_module_going(mod); > >+ > >+ return err; > > } > > > > static int unknown_module_param_cb(char *param, char *val, const char > > *modname, > > > > This looks fine to me - klp_module_going() is only called after > successful klp_module_coming(), and klp_module_going() is fine with > mod->state still being MODULE_STATE_COMING here. Would be good to have > livepatch folks double check. Yes, it is ok. > Which reminds me - Miroslav had pointed > out in the past that if there is an error when calling the COMING > notifiers, the GOING notifiers will be called while the mod->state is > still MODULE_STATE_COMING. I've briefly looked through all the module > notifiers and it looks like nobody is looking at mod->state directly > at least. Thanks for double-checking. I triple-checked and yes, it should be fine. All module notifiers check the value from the function parameter and not mod->state directly. Reviewed-by: Miroslav Benes M