Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1390532ybg; Fri, 18 Oct 2019 17:18:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjSyynXeUgT4vVW66wDYDwo5pxecfZN6lgFC2uWjYnwah8sOHcjLefmqRR/25/gbmQ3Hiw X-Received: by 2002:a50:f742:: with SMTP id j2mr12521343edn.253.1571444330738; Fri, 18 Oct 2019 17:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571444330; cv=none; d=google.com; s=arc-20160816; b=P8PFgmQNu6XVC6GyMYf8smOr7I2kxZwr9OSfYA9P9RvUtKU/uWA6uRU5jglRWY7V+8 MeDgUa2YQhkH3SAC7e3PzmTMVox8MZYZz2nAosMwgEVwvw83i5um0XBLvCu41cJgb2a2 GqoHXZiFQ6EzpEBn7OIfKdfP7S8WQiAsT4TG7wf+RG+n7Ee+HQDwE2j9WygsfxStqmFH ELQOISIYdc27XoKVwJkAlNQOybUWj1AIM3OyXCJlBDevkxL8Y2L0rDU63S8KqWLBGLX5 olA92DpSC6JMPb7n9ZlaQ2wHeeofwB7+CRi4oRHuSRiqkKdPI66PFmowyuTcfB8h+cve czYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:subject:cc:to :from:date:user-agent:message-id:dkim-signature; bh=Oj8zH6+/xCj/G3jY2+2E8ub8KpY3i+WGmGVOUbOAPRc=; b=oGRnoRg8YUvavdDkrpT78xwLLu8CbEzCBI3ZaRjvtdHyk0OlJF6JhjuQ5B+wn6knbO hIhqjhfY/iGFzrhB/aBYTxFk7RtY/ExC/heIFkch9otElVdUJUz+RKiVAViCr3Cwqzrm TvYsWa3BUB7zoeqieV6BznKCmugtzQOc4yzZTYAssdFTSPWSPXinPOU4dyHfKRRPiz4W L3XVbfljmdq2z6AUZWTzQLej1yTA048cLl4zSiVKgI0GU/JqGq48nVWzmmDh4bAQrqIs NkOtTAKzc5WeUpj3GjfxTxsUI1ysToNxYSsiZXdNX4cpzhmxWUSc5HV0lYEu6K+HLO5Q kEmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="PY3/Po/h"; 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 b22si4187285eje.299.2019.10.18.17.18.27; Fri, 18 Oct 2019 17:18: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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="PY3/Po/h"; 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 S2504730AbfJRHv2 (ORCPT + 99 others); Fri, 18 Oct 2019 03:51:28 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42884 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2504683AbfJRHv2 (ORCPT ); Fri, 18 Oct 2019 03:51:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-Id:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Oj8zH6+/xCj/G3jY2+2E8ub8KpY3i+WGmGVOUbOAPRc=; b=PY3/Po/hwir1kh1R/h4t+RVLSw hnRLNixNOEgWbNO1gtAlXzn6TttzbNRm+k2wCAOwsj9srT5yqtq/DQz758eksy68ffzTrNVFtqgUk F3/TfrCpOu+1Q/uRbQgL2U8J2QNG3aV1PHy0Ty6BcM69TXocjdyGUzrnC6AlsYUiLzbSvt5o8mwjM QYhBtzCmHTTUzfbGypn7XeI18gpKrY0n+59VB9A44yZzDmYLo3o82gH+bLD6GTmtE3ikRT97Tj5Ej u5nHIFFGcrJl9twpjW87VsVgTWBGq2Y5LDXYcJ52QVBch/rhaDTLAV9Z7M50+6ev3lPF5gDuTsRv4 REmEVwdA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iLN2d-0001PE-2S; Fri, 18 Oct 2019 07:51:19 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 26B29306BF0; Fri, 18 Oct 2019 09:50:20 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 6BF102B17811B; Fri, 18 Oct 2019 09:51:15 +0200 (CEST) Message-Id: <20191018074634.801435443@infradead.org> User-Agent: quilt/0.65 Date: Fri, 18 Oct 2019 09:35:40 +0200 From: Peter Zijlstra To: x86@kernel.org Cc: peterz@infradead.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, jeyu@kernel.org Subject: [PATCH v4 15/16] module: Move where we mark modules RO,X References: <20191018073525.768931536@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that set_all_modules_text_*() is gone, nothing depends on the relation between ->state = 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. Signed-off-by: Peter Zijlstra (Intel) Cc: Jessica Yu --- kernel/module.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/kernel/module.c +++ b/kernel/module.c @@ -3683,10 +3683,6 @@ static int complete_formation(struct mod /* This relies on module_mutex for list integrity. */ module_bug_finalize(info->hdr, info->sechdrs, mod); - module_enable_ro(mod, false); - module_enable_nx(mod); - module_enable_x(mod); - /* Mark state as coming so strong_try_module_get() ignores us, * but kallsyms etc. can see us. */ mod->state = MODULE_STATE_COMING; @@ -3852,6 +3848,10 @@ static int load_module(struct load_info if (err) goto bug_cleanup; + module_enable_ro(mod, false); + module_enable_nx(mod); + module_enable_x(mod); + /* Module is ready to execute: parsing args may do that. */ after_dashes = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, -32768, 32767, mod,