Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4296731ybg; Mon, 21 Oct 2019 06:54:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQlfNLoSu0So2GcRLH7Q0sSfzXh65LU01j4O/cm8oUzD4P4tvC5NmXmt02EuwxA5qLLkgK X-Received: by 2002:a17:906:4ec2:: with SMTP id i2mr6056640ejv.330.1571666087692; Mon, 21 Oct 2019 06:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571666087; cv=none; d=google.com; s=arc-20160816; b=Sx03jw0aicxpunCqclkTRPu4VUEpaqG5yPvGrPZ/SGN7GPp+L1RP1UbGzZ0VfPRiK7 a2jo+P4ybwfh8MC/iGkdld7VgdiP2Bo9Tgb7k6niFhah0UprDVDSnSRcjsvnuImKAOFV qkpuEtOLjcvCC5nUYRBuSOeo7B2U5op6sOv8AWs2YAIP+nqQ9oVaNwkghf6TweQGlQ0G iTlXZO4HxVLw9FIz5qZHnXvxZ5tACMyIdQ04SfZ5VU7CAV5BSVw6OCnhb0hKlRn9HCKC dpWFsYzZWXf7P5OGOiOr/3hXQKmp93616QCwYroPGeTNHPvu34oxL8BOzE1G79TMgf4V oRwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=l+azFbWYGdODst3YpR9ii/SydvWcP8Z6kN7+s80qYWg=; b=Ukd+RtZelyWM9h9YApwS7ZawCWfbtiAyNHv7CulM/e7NCIZDqnOUrqag7t47skCWXT 2sCSElgMf18V/09CFBZrBSi2hYtLbvR9eH/45Fx1ZaphnlNwG6472LzVwh4e3GFlTxV1 7RZncELmGh9LFpKJjFf+HxekGc41lBMYprvYfWrdWTc10bqKwhsAKUNbqBSroCzz9jgX 8pTOINvA1K0OuCwkd9a2OJt/SZs2mmmnpZZK4U9PCSh4P4k+9Ccp3zh2hF4rUuWjbHOM xZZz66nXvT4Mk7gRpQHP57TNgxWStaV5Wip7wIl4fCM9mwppXxjrtENvEmMpvF47ATAJ kOuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KCaBw+N6; 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 z7si10083610edb.160.2019.10.21.06.54.23; Mon, 21 Oct 2019 06:54:47 -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=KCaBw+N6; 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 S1729065AbfJUNxZ (ORCPT + 99 others); Mon, 21 Oct 2019 09:53:25 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:48379 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728819AbfJUNxZ (ORCPT ); Mon, 21 Oct 2019 09:53:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571666003; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l+azFbWYGdODst3YpR9ii/SydvWcP8Z6kN7+s80qYWg=; b=KCaBw+N6tZh+c72k1CFmRUNBywxtByGBbtXDT/F4LS9F8NMoCq3rXVAYk1yq2NFpMFFJ+D 2EEsDCSh0XwxutO4zw4lA2J0OiHoBq40KI1a3BOC8uhcTJ+x12wFBo1uaa0aADsGwrnoTa Iv8isU8OJ8El/Gfvhyo3o7NQzAX/6JY= 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-172-dtCkrvXnMl6TL-SQC55TFA-1; Mon, 21 Oct 2019 09:53:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0C1F91800DC7; Mon, 21 Oct 2019 13:53:18 +0000 (UTC) Received: from treble (ovpn-123-96.rdu2.redhat.com [10.10.123.96]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 34F7760A9F; Mon, 21 Oct 2019 13:53:15 +0000 (UTC) Date: Mon, 21 Oct 2019 08:53:12 -0500 From: Josh Poimboeuf 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, jeyu@kernel.org Subject: Re: [PATCH v4 15/16] module: Move where we mark modules RO,X Message-ID: <20191021135312.jbbxsuipxldocdjk@treble> References: <20191018073525.768931536@infradead.org> <20191018074634.801435443@infradead.org> MIME-Version: 1.0 In-Reply-To: <20191018074634.801435443@infradead.org> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: dtCkrvXnMl6TL-SQC55TFA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 18, 2019 at 09:35:40AM +0200, Peter Zijlstra wrote: > Now that set_all_modules_text_*() is gone, nothing depends on the > relation between ->state =3D COMING and the protection state anymore. > This enables moving the protection changes later, such that the COMING > notifier callbacks can more easily modify the text. >=20 > Signed-off-by: Peter Zijlstra (Intel) > Cc: Jessica Yu > --- > kernel/module.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > --- a/kernel/module.c > +++ b/kernel/module.c > @@ -3683,10 +3683,6 @@ static int complete_formation(struct mod > =09/* This relies on module_mutex for list integrity. */ > =09module_bug_finalize(info->hdr, info->sechdrs, mod); > =20 > -=09module_enable_ro(mod, false); > -=09module_enable_nx(mod); > -=09module_enable_x(mod); > - > =09/* Mark state as coming so strong_try_module_get() ignores us, > =09 * but kallsyms etc. can see us. */ > =09mod->state =3D MODULE_STATE_COMING; > @@ -3852,6 +3848,10 @@ static int load_module(struct load_info > =09if (err) > =09=09goto bug_cleanup; > =20 > +=09module_enable_ro(mod, false); > +=09module_enable_nx(mod); > +=09module_enable_x(mod); > + > =09/* Module is ready to execute: parsing args may do that. */ > =09after_dashes =3D parse_args(mod->name, mod->args, mod->kp, mod->num_k= p, > =09=09=09=09 -32768, 32767, mod, [ Sorry if this was already discussed, I still have a large backlog. ] Doesn't livepatch code also need to be modified? We have: prepare_coming_module() =09klp_module_coming() =09=09klp_init_object_loaded() =09=09=09module_disable_ro() =09=09=09... =09=09=09module_enable_ro() which is done right before the above patch does module_enable_ro(). We could remove the disable-RO from that case, though we'd still need it for another case (late module patching). --=20 Josh