[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57afeae7c0df4a9e76d44d69681e815e37d03d6e.1643919758.git.christophe.leroy@csgroup.eu>
Date: Thu, 3 Feb 2022 20:23:27 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: "atomlin@...hat.com" <atomlin@...hat.com>,
Luis Chamberlain <mcgrof@...nel.org>,
"linux-modules@...r.kernel.org" <linux-modules@...r.kernel.org>
CC: Christophe Leroy <christophe.leroy@...roup.eu>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH 2/2] modules: Rename debug_align() as section_align()
debug_align() was added by commit 84e1c6bb38eb ("x86: Add RO/NX
protection for loadable kernel modules")
At that time the config item was CONFIG_DEBUG_SET_MODULE_RONX.
But nowadays it has changed to CONFIG_STRICT_MODULE_RWX and
debug_align() is confusing because it has nothing to do with
DEBUG.
Rename it section_align()
While at it, use PAGE_ALIGN(x) instead of ALIGN(x, PAGE_SIZE).
Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
---
kernel/module.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/kernel/module.c b/kernel/module.c
index 44ed39cbbd17..fb30249a05bb 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -73,9 +73,9 @@
* only when CONFIG_STRICT_MODULE_RWX=y
*/
#ifdef CONFIG_STRICT_MODULE_RWX
-# define debug_align(X) ALIGN(X, PAGE_SIZE)
+# define section_align(X) PAGE_ALIGN(X)
#else
-# define debug_align(X) (X)
+# define section_align(X) (X)
#endif
/* If this is set, the section belongs in the init part of the module */
@@ -2454,19 +2454,19 @@ static void layout_sections(struct module *mod, struct load_info *info)
}
switch (m) {
case 0: /* executable */
- mod->core_layout.size = debug_align(mod->core_layout.size);
+ mod->core_layout.size = section_align(mod->core_layout.size);
mod->core_layout.text_size = mod->core_layout.size;
break;
case 1: /* RO: text and ro-data */
- mod->core_layout.size = debug_align(mod->core_layout.size);
+ mod->core_layout.size = section_align(mod->core_layout.size);
mod->core_layout.ro_size = mod->core_layout.size;
break;
case 2: /* RO after init */
- mod->core_layout.size = debug_align(mod->core_layout.size);
+ mod->core_layout.size = section_align(mod->core_layout.size);
mod->core_layout.ro_after_init_size = mod->core_layout.size;
break;
case 4: /* whole core */
- mod->core_layout.size = debug_align(mod->core_layout.size);
+ mod->core_layout.size = section_align(mod->core_layout.size);
break;
}
}
@@ -2488,11 +2488,11 @@ static void layout_sections(struct module *mod, struct load_info *info)
}
switch (m) {
case 0: /* executable */
- mod->init_layout.size = debug_align(mod->init_layout.size);
+ mod->init_layout.size = section_align(mod->init_layout.size);
mod->init_layout.text_size = mod->init_layout.size;
break;
case 1: /* RO: text and ro-data */
- mod->init_layout.size = debug_align(mod->init_layout.size);
+ mod->init_layout.size = section_align(mod->init_layout.size);
mod->init_layout.ro_size = mod->init_layout.size;
break;
case 2:
@@ -2503,7 +2503,7 @@ static void layout_sections(struct module *mod, struct load_info *info)
mod->init_layout.ro_after_init_size = mod->init_layout.ro_size;
break;
case 4: /* whole init */
- mod->init_layout.size = debug_align(mod->init_layout.size);
+ mod->init_layout.size = section_align(mod->init_layout.size);
break;
}
}
@@ -2724,7 +2724,7 @@ static void layout_symtab(struct module *mod, struct load_info *info)
mod->core_layout.size += strtab_size;
info->core_typeoffs = mod->core_layout.size;
mod->core_layout.size += ndst * sizeof(char);
- mod->core_layout.size = debug_align(mod->core_layout.size);
+ mod->core_layout.size = section_align(mod->core_layout.size);
/* Put string table section at end of init part of module. */
strsect->sh_flags |= SHF_ALLOC;
@@ -2739,7 +2739,7 @@ static void layout_symtab(struct module *mod, struct load_info *info)
mod->init_layout.size += sizeof(struct mod_kallsyms);
info->init_typeoffs = mod->init_layout.size;
mod->init_layout.size += nsrc * sizeof(char);
- mod->init_layout.size = debug_align(mod->init_layout.size);
+ mod->init_layout.size = section_align(mod->init_layout.size);
}
/*
--
2.33.1
Powered by blists - more mailing lists