Thread (32 messages) 32 messages, 5 authors, 2022-02-23

Re: [PATCH v6 06/13] module: Move strict rwx support to a separate file

From: Christophe Leroy <hidden>
Date: 2022-02-21 06:31:16
Also in: live-patching, lkml


Le 18/02/2022 à 22:25, Aaron Tomlin a écrit :
No functional change.

This patch migrates code that makes module text
and rodata memory read-only and non-text memory
non-executable from core module code into
kernel/module/strict_rwx.c.

Signed-off-by: Aaron Tomlin <redacted>
---
  kernel/module/Makefile     |  1 +
  kernel/module/internal.h   | 38 +++++++++++++++
  kernel/module/main.c       | 99 +-------------------------------------
  kernel/module/strict_rwx.c | 84 ++++++++++++++++++++++++++++++++
  4 files changed, 125 insertions(+), 97 deletions(-)
  create mode 100644 kernel/module/strict_rwx.c
   CC      kernel/module/strict_rwx.o
In file included from ./include/linux/build_bug.h:5,
                  from ./include/linux/container_of.h:5,
                  from ./include/linux/list.h:5,
                  from ./include/linux/module.h:12,
                  from kernel/module/strict_rwx.c:8:
kernel/module/strict_rwx.c: In function 'frob_rodata':
kernel/module/strict_rwx.c:16:17: error: implicit declaration of 
function 'PAGE_ALIGNED'; did you mean 'IS_ALIGNED'? 
[-Werror=implicit-function-declaration]
    16 |         BUG_ON(!PAGE_ALIGNED(layout->base));
       |                 ^~~~~~~~~~~~
./include/linux/compiler.h:78:45: note: in definition of macro 'unlikely'
    78 | # define unlikely(x)    __builtin_expect(!!(x), 0)
       |                                             ^
kernel/module/strict_rwx.c:16:9: note: in expansion of macro 'BUG_ON'
    16 |         BUG_ON(!PAGE_ALIGNED(layout->base));
       |         ^~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:288 : kernel/module/strict_rwx.o] 
Erreur 1



You have to include <linux/mm.h>

Christophe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help