Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755497AbcJ0NwI (ORCPT ); Thu, 27 Oct 2016 09:52:08 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:35729 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754883AbcJ0Nv7 (ORCPT ); Thu, 27 Oct 2016 09:51:59 -0400 From: Aaron Tomlin To: linux-kernel@vger.kernel.org Cc: rusty@rustcorp.com.au, rostedt@goodmis.org Subject: [RFC PATCH v2 2/2] module: When modifying a module's text ignore modules which are going away too Date: Thu, 27 Oct 2016 10:36:06 +0100 Message-Id: <1477560966-781-1-git-send-email-atomlin@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <20161026080914.5bc68d0d@gandalf.local.home> References: <20161026080914.5bc68d0d@gandalf.local.home> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 944 Lines: 29 By default, during the access permission modification of a module's core and init pages, we only ignore modules that are malformed. Albeit for a module which is going away, it does not make sense to change its text to RO since the module should be RW, before deallocation. This patch makes set_all_modules_text_ro() skip modules which are going away too. Signed-off-by: Aaron Tomlin --- kernel/module.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/module.c b/kernel/module.c index ff93ab8..2a383df 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1969,7 +1969,8 @@ void set_all_modules_text_ro(void) mutex_lock(&module_mutex); list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) + if (mod->state == MODULE_STATE_UNFORMED || + mod->state == MODULE_STATE_GOING) continue; frob_text(&mod->core_layout, set_memory_ro); -- 2.5.5