Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2095755ybb; Thu, 26 Mar 2020 21:52:11 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsmKnmZpROSxg0CHEu5Toy40pIkhoUsiRW1OiYTjv+1Ye1AibtO2RQjlIWPJp7OP85vDFW2 X-Received: by 2002:aca:c3d1:: with SMTP id t200mr2872780oif.24.1585284731511; Thu, 26 Mar 2020 21:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585284731; cv=none; d=google.com; s=arc-20160816; b=W5U10dRqV+AANIT15Gv4XacKyxhgBU3HO4EeaVxxyRHzZ9scWknXbhiW91vQWh0hqO M35jcGzT4XqnYL9os1sOtvIEfD1WbP5Ig4ezOBCfsyP7yfnm07oox3JiuNi1f0/T+fkc nAroxqgyWSA/15sQiusyQD5eWoQ3554y7AU6w//b8IZ/4m6z4TAeJ9QNlA5HyJP9tK4H oC4ChMSL7/1W5WDVv7eHyEqqik6QMQ0CovoSH3KaVRJeXfd5OckIhRksSn80/u1bFgG2 cZ+fVZ+mocw21tERdpZCjOk5fzctMYlr92s5cG24uVDh2sBu9cdRGbwYQKBox/ucMEnp z8sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=/bfRnjUF9okDBSODyoBPPTnAyjMFKuJMpBFwnLOeDBI=; b=fGWh2wNmc7eZu3ECqBwluZ9h3zFb4btQ2/ZmH+2JtnqFt9BbTcXNQ8IMGP/UItpglx h7myskXyDq56xdX6yYmmHC3JHuy0aXfd/tV/Fj6lL6QQKLpS5X1Z7p5eFM5UTLkjx/OW E1V3bYh4qMY2laWFTBAm9yB2usXNDKf4JzFX8h/fmjtTIff2PRqISgcHx+xpDmoHmM0o gFgDjtqQXxa8WGfZ8aUqcbr/XLaXrruYqcpfMLO+eZDX7xThOZUBW4W1fMnZyfuhUaqc AkHAEoFmh4+YEfEYyYxamuWuhBF3/Z0XIHRdTFka+vo/v4BYaxUunBkq6yCihf5E192M QzeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L1T5HMg+; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p21si2062542oto.4.2020.03.26.21.51.58; Thu, 26 Mar 2020 21:52:11 -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=@redhat.com header.s=mimecast20190719 header.b=L1T5HMg+; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726454AbgC0Evf (ORCPT + 99 others); Fri, 27 Mar 2020 00:51:35 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:59215 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726217AbgC0Evf (ORCPT ); Fri, 27 Mar 2020 00:51:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585284693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/bfRnjUF9okDBSODyoBPPTnAyjMFKuJMpBFwnLOeDBI=; b=L1T5HMg+xcZTQr7iw5q6kLnMU1WIku8PAU9IWNXE6rclsQaFV0zW5FECwdV0Tr9MM4tCyT DNqIi9VxFRHdXUPforj8eUQqrW/ofZyNp8glSMekoSqXSPjZBx3sLSkPGX352Op5qbQMDZ 7jk6OeHYWLseetcgh8hnQUmuUWnzv2s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-415-vZmYp6t-NtCnCeL4FoBT2Q-1; Fri, 27 Mar 2020 00:51:30 -0400 X-MC-Unique: vZmYp6t-NtCnCeL4FoBT2Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E952C107ACC4; Fri, 27 Mar 2020 04:51:27 +0000 (UTC) Received: from treble (unknown [10.10.110.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B585219C69; Fri, 27 Mar 2020 04:51:21 +0000 (UTC) Date: Thu, 26 Mar 2020 23:51:19 -0500 From: Josh Poimboeuf 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, live-patching@vger.kernel.org Subject: Re: [RESEND][PATCH v3 03/17] module: Properly propagate MODULE_STATE_COMING failure Message-ID: <20200327045119.r7f6b6y2riyagemx@treble> References: <20200324135603.483964896@infradead.org> <20200324142245.445253190@infradead.org> <20200325173519.GA5415@linux-8ccs> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200325173519.GA5415@linux-8ccs> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 25, 2020 at 06:35:22PM +0100, 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. 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 Looks good to me. klp_module_going() is already called in other load_module() error scenarios so this should be fine from a livepatch standpoint. Acked-by: Josh Poimboeuf -- Josh