Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp841569ybb; Wed, 25 Mar 2020 10:37:16 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvnDd2jcIS0m1PlLrHHFfB75F+8N260DvMqLWNaBkMVs16LqJQacvLWXJICMi5zaURwv2kb X-Received: by 2002:aca:5e88:: with SMTP id s130mr3173163oib.47.1585157836000; Wed, 25 Mar 2020 10:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585157835; cv=none; d=google.com; s=arc-20160816; b=aprq4jhVmBlNbsliT6z7eaoDw/vTdYNMspe9jYvE0j2LSIcK1wL5S5/U9YyEPJEABf zUi4EP/DfUytoaji332ibUQRD5ZVW8u5Zuv/JlAo4LU6LkQKvcNWRD9NGKcD/ErRM3F+ 4HcLoKcdT7+qG2CMtzT2A/RGwjDcw4d186JTh6i+R6AEDigQCrDPLFZuS7kTNr+AU5vZ PZKDYeD7/WDZQBxA0DmMy/Y7pmLY240IUXzYCbXeoPwFoNLGMRrBLe8JuWlo2cSViljZ fqz7luyXCwsjfB380YLrDzNHMsvIUOLLi3HsIQXIUN1SUcSM1D5JTmGs8PhIX9LYQ1g0 YuQQ== 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=koIZIvSbpjouF2vynMOash8xHFsKgcLoLuJ5JbNIIHk=; b=ER3xF6N6BLItEb2/F06JEzl1FKQepMVv5EsMWOpdO3GicWvqKkpgKviRW9VW+D96TK 0cq5GG8PFe4sU4nLF1SOUQnDgQjCxX4zZIirFXGcUC8DH6d4PhMf+HeuvUyUKQOnH711 F15sxIcu49d3Opioi8fTYabPkrI3euS2ik0elUPAYlgCTb/B0mrl7fbFHiuqEMpyokWl oPMoUml38U5ovHV7xt9ozrjY6uU2uv9ihph7YFOc6KIIt4gMbBJjdtQ99I8cD+MXpmIN W/fgwgPgJdv9FDymAaDCUwe4VJTvw6fTuOnUOe4ISWjcjqkH/5eY5GwuO89GyN4I3rao sXbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cpFspdu5; 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 s6si1712106oou.8.2020.03.25.10.37.02; Wed, 25 Mar 2020 10:37:15 -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=cpFspdu5; 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 S1727655AbgCYRf3 (ORCPT + 99 others); Wed, 25 Mar 2020 13:35:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:57938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727129AbgCYRf3 (ORCPT ); Wed, 25 Mar 2020 13:35:29 -0400 Received: from linux-8ccs (p5B2812F9.dip0.t-ipconnect.de [91.40.18.249]) (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 DC0CA20740; Wed, 25 Mar 2020 17:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585157728; bh=uoqoCTnzrI1QvRiPoGYOHLfI25++lyJvjrMQ4QB/UTQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cpFspdu5nq1sGD8h5Ph531tuDJOEzmeuHg2VBJLfG6Gsbd5Dz9ZH4tGJY1cdD2WnE +tOmSNrA8X67i/nCyaICUtIf/e/beNuVl6SGS29e3o2LeXLuYWLBNB+zyyBqXSD5/k f8cwagp8KdMs1YkI2vwTniIyWfMOLR3HxeRjtEV4= Date: Wed, 25 Mar 2020 18:35:22 +0100 From: Jessica Yu To: Peter Zijlstra Cc: 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 Message-ID: <20200325173519.GA5415@linux-8ccs> References: <20200324135603.483964896@infradead.org> <20200324142245.445253190@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200324142245.445253190@infradead.org> X-OS: Linux linux-8ccs 4.12.14-lp150.12.61-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 [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. 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. Acked-by: Jessica Yu