[PATCH v2 0/3] kprobes: Remove MODULE dependency

Jarkko Sakkinen jarkko.sakkinen at linux.intel.com
Tue Jul 14 05:45:35 EDT 2020


Remove MODULES dependency by creating module subsystem indepdent
text_alloc() and text_memfree() to allocate space for executable code.

Right now one has to compile modules support only to enable kprobes. This
incrases the barrier to use them in test kernels and I'd guess also in some
embedded kernels (the former is my use case).

v2:
* Added the missing cover letter.

Jarkko Sakkinen (3):
  module: Rename module_alloc() to text_alloc() and move to kernel
    proper
  module: Add lock_modules() and unlock_modules()
  kprobes: Flag out CONFIG_MODULES dependent code

 arch/Kconfig                     |  1 -
 arch/arm/kernel/Makefile         |  3 +-
 arch/arm/kernel/module.c         | 21 -------
 arch/arm/kernel/text.c           | 33 +++++++++++
 arch/arm64/kernel/Makefile       |  2 +-
 arch/arm64/kernel/module.c       | 42 --------------
 arch/arm64/kernel/text.c         | 54 ++++++++++++++++++
 arch/mips/kernel/Makefile        |  2 +-
 arch/mips/kernel/module.c        |  9 ---
 arch/mips/kernel/text.c          | 19 +++++++
 arch/mips/net/bpf_jit.c          |  4 +-
 arch/nds32/kernel/Makefile       |  2 +-
 arch/nds32/kernel/module.c       |  7 ---
 arch/nds32/kernel/text.c         | 12 ++++
 arch/nios2/kernel/Makefile       |  1 +
 arch/nios2/kernel/module.c       | 19 -------
 arch/nios2/kernel/text.c         | 34 +++++++++++
 arch/parisc/kernel/Makefile      |  2 +-
 arch/parisc/kernel/module.c      | 11 ----
 arch/parisc/kernel/text.c        | 22 ++++++++
 arch/powerpc/net/bpf_jit_comp.c  |  4 +-
 arch/riscv/kernel/Makefile       |  1 +
 arch/riscv/kernel/module.c       | 12 ----
 arch/riscv/kernel/text.c         | 20 +++++++
 arch/s390/kernel/Makefile        |  2 +-
 arch/s390/kernel/ftrace.c        |  2 +-
 arch/s390/kernel/module.c        | 16 ------
 arch/s390/kernel/text.c          | 23 ++++++++
 arch/sparc/kernel/Makefile       |  1 +
 arch/sparc/kernel/module.c       | 30 ----------
 arch/sparc/kernel/text.c         | 39 +++++++++++++
 arch/sparc/net/bpf_jit_comp_32.c |  6 +-
 arch/unicore32/kernel/Makefile   |  1 +
 arch/unicore32/kernel/module.c   |  7 ---
 arch/unicore32/kernel/text.c     | 18 ++++++
 arch/x86/kernel/Makefile         |  1 +
 arch/x86/kernel/ftrace.c         |  4 +-
 arch/x86/kernel/kprobes/core.c   |  4 +-
 arch/x86/kernel/module.c         | 49 ----------------
 arch/x86/kernel/text.c           | 60 ++++++++++++++++++++
 include/linux/module.h           | 29 +++++++---
 include/linux/moduleloader.h     |  4 +-
 kernel/Makefile                  |  2 +-
 kernel/bpf/core.c                |  4 +-
 kernel/kprobes.c                 | 17 ++++--
 kernel/livepatch/core.c          |  8 +--
 kernel/module.c                  | 97 +++++++++++++-------------------
 kernel/text.c                    | 25 ++++++++
 kernel/trace/trace_kprobe.c      | 20 ++++++-
 49 files changed, 484 insertions(+), 322 deletions(-)
 create mode 100644 arch/arm/kernel/text.c
 create mode 100644 arch/arm64/kernel/text.c
 create mode 100644 arch/mips/kernel/text.c
 create mode 100644 arch/nds32/kernel/text.c
 create mode 100644 arch/nios2/kernel/text.c
 create mode 100644 arch/parisc/kernel/text.c
 create mode 100644 arch/riscv/kernel/text.c
 create mode 100644 arch/s390/kernel/text.c
 create mode 100644 arch/sparc/kernel/text.c
 create mode 100644 arch/unicore32/kernel/text.c
 create mode 100644 arch/x86/kernel/text.c
 create mode 100644 kernel/text.c

-- 
2.25.1




More information about the linux-riscv mailing list