Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1264024ybi; Fri, 14 Jun 2019 11:24:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvnf/r9GBnBm8yqNCsuzzhPFnqrtJMAkiPJTsqrssCyepHODfgKm5jvCJu9Fn4nAfsjSip X-Received: by 2002:a17:902:830b:: with SMTP id bd11mr42798094plb.202.1560536690564; Fri, 14 Jun 2019 11:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560536690; cv=none; d=google.com; s=arc-20160816; b=Tm02kaa6qHaIC7vhxuVSn/oEI5pS/5QgGau0PbApUwIMlqOU1vGvxMWs0J/QoxbMFW EZMTRss2oegF0ebY8mkDT/iQbwcC7AMl6WFKmrjFGncChMTfqprRkJN20ELYQt3gf6R4 T7DKH8kb69HhEdkhEGCyWWKkbIE1SnStozln2T7raIWYJ+Px9+YVjYW8MqhWF9XAQjjT HgEY+pnMs96wTQQmhCQx6JVkrOUeqykEK6J3VNm46LZKyTrpZdz0AY33Px9njLWsPtqV XXZY84y9sCB31V6M5njmcwQTcZlrF53v0VV5OugOqOh69Y5qxTE1NF/KyQQvjIOBa1E8 5P3Q== 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; bh=HKOx1PHMzK39ORDdj5qWYaWNq6gHK5yUjDtpLYJ4RIk=; b=khnrYZSEEO656ffOjfuomgMWz05r3s3M5E2VK2naBWTPIMPnJ+num3OeZT35H6E6Zx xnJt7Kschmf3xNMeE+ZwvZCeF+ZpFquDt7vhH63YhRYpd/9wHXgH+pfKmxj884UJ5Pzc XVs9D1yJAZgGjjTVF6PXW/pizRen/pNaMo/vOkwAKGbsaouww1lbsMLKEROU5J+vVbXf u4OZ8HRpUr9LxMUMVORT1SiIv/NEZQrsAJpLYYHzFxLpdnQBooKaUilYJuWSiTIblpHI PNFMeaLYu+x8YRP6+nFfA0p2Hemym41Do1mjuxkS4u7A+5nWsmydzFNlGEqk5vbWigxr 45wQ== 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; dmarc=fail (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 f12si3145486pgs.37.2019.06.14.11.24.35; Fri, 14 Jun 2019 11:24:50 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726344AbfFNSXw (ORCPT + 99 others); Fri, 14 Jun 2019 14:23:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52226 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725814AbfFNSXw (ORCPT ); Fri, 14 Jun 2019 14:23:52 -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 mx1.redhat.com (Postfix) with ESMTPS id 9760F6696C; Fri, 14 Jun 2019 18:23:46 +0000 (UTC) Received: from treble (ovpn-121-232.rdu2.redhat.com [10.10.121.232]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 417006402F; Fri, 14 Jun 2019 18:23:43 +0000 (UTC) Date: Fri, 14 Jun 2019 13:23:41 -0500 From: Josh Poimboeuf To: Petr Mladek Cc: Jessica Yu , Steven Rostedt , Jiri Kosina , Miroslav Benes , Joe Lawrence , linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Johannes Erdfelt , Ingo Molnar Subject: Re: [PATCH 3/3] module: Improve module __ro_after_init handling Message-ID: <20190614182341.sq4yngzmoobsyinq@treble> References: <1b72f40d863a1444f687b3e1b958bdc6925882ed.1560474114.git.jpoimboe@redhat.com> <20190614141453.fjtvk7uvux6vcmlp@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190614141453.fjtvk7uvux6vcmlp@pathway.suse.cz> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 14 Jun 2019 18:23:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 14, 2019 at 04:14:53PM +0200, Petr Mladek wrote: > > -void __module_enable_ro(const struct module *mod, bool after_init) > > +static void __module_enable_ro(const struct module *mod) > > { > > if (!rodata_enabled) > > return; > > @@ -1973,15 +1973,15 @@ void __module_enable_ro(const struct module *mod, bool after_init) > > > > frob_rodata(&mod->init_layout, set_memory_ro); > > > > - if (after_init) > > + if (mod->state == MODULE_STATE_LIVE) > > frob_ro_after_init(&mod->core_layout, set_memory_ro); > > This works only now because __module_enable_ro() is called only from > three locations (klp_init_object_loaded(), complete_formation(), > and do_init_module(). And they all are called in a well defined order > from load_module(). > > Only the final call in do_init_module() should touch the after_init > section. > > IMHO, the most clean solutiuon would be to call frob_ro_after_init() > from extra __module_after_init_enable_ro() or so. This should be > called only from the single place. Agreed, that would be better. I'll be gone for a week but I'll make these changes when I get back. Thanks. -- Josh