Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034090AbcJTQSX (ORCPT ); Thu, 20 Oct 2016 12:18:23 -0400 Received: from mail-lf0-f52.google.com ([209.85.215.52]:35116 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034046AbcJTQSU (ORCPT ); Thu, 20 Oct 2016 12:18:20 -0400 From: Aaron Tomlin To: linux-kernel@vger.kernel.org Cc: rusty@rustcorp.com.au, rostedt@goodmis.org Subject: [RFC PATCH 2/2] module: When modifying a module's text ignore modules which are going away too Date: Thu, 20 Oct 2016 17:18:13 +0100 Message-Id: <1476980293-19062-3-git-send-email-atomlin@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1476980293-19062-1-git-send-email-atomlin@redhat.com> References: <1476980293-19062-1-git-send-email-atomlin@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1246 Lines: 38 By default, during the access permission modification of a module's core and init pages, we only ignore modules that are malformed. There is no reason not to extend this to modules which are going away too. This patch makes both set_all_modules_text_rw() and set_all_modules_text_ro() skip modules which are going away too. Signed-off-by: Aaron Tomlin --- kernel/module.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index ff93ab8..09c386b 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1953,7 +1953,8 @@ void set_all_modules_text_rw(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_rw); @@ -1969,7 +1970,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