From patchwork Tue Jul 14 09:45:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 1328812 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B5cRB5fY6z9s1x for ; Tue, 14 Jul 2020 20:37:42 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4B5cRB5BydzDqcv for ; Tue, 14 Jul 2020 20:37:42 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.intel.com (client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=jarkko.sakkinen@linux.intel.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4B5bK9022hzDqLr for ; Tue, 14 Jul 2020 19:47:23 +1000 (AEST) IronPort-SDR: 6ljhCjQYc8saOOrUhV5hESNwvppN9RtNnB3Cntw0bpXh5reKGpze3VUNm3nzB0ZOMJYNzdJKsF 4bkxZBZFMRzg== X-IronPort-AV: E=McAfee;i="6000,8403,9681"; a="213661351" X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="213661351" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2020 02:47:19 -0700 IronPort-SDR: tnOCkLt8IfVkm5xN3VakaM9NZRaZ4I7vcKaIxPq0JkwL/dnT/xa9qFx9uW0JY5/S7u+lxPJYn9 QgrYykxLQnPw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,350,1589266800"; d="scan'208";a="429708293" Received: from rmarti11-mobl.ger.corp.intel.com (HELO localhost) ([10.252.54.57]) by orsmga004.jf.intel.com with ESMTP; 14 Jul 2020 02:46:40 -0700 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org Subject: [PATCH v2 0/3] kprobes: Remove MODULE dependency Date: Tue, 14 Jul 2020 12:45:35 +0300 Message-Id: <20200714094625.1443261-1-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 20:36:21 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , Song Liu , Paul Mackerras , Zong Li , Paul Burton , "Aneesh Kumar K.V" , Vincent Whitchurch , Omar Sandoval , Petr Mladek , Brian Gerst , Andy Lutomirski , Thomas Gleixner , Iurii Zaikin , Jiri Kosina , Anup Patel , Philipp Rudo , Vincent Chen , Torsten Duwe , Masami Hiramatsu , Andrew Morton , Mark Rutland , Ingo Molnar , "open list:S390" , Joe Lawrence , Alexandre Ghiti , Helge Deller , John Fastabend , Yonghong Song , Borislav Petkov , Andrii Nakryiko , Vasily Gorbik , "moderated list:ARM PORT" , Daniel Axtens , Damien Le Moal , Stephen Boyd , Sean Christopherson , Martin KaFai Lau , Kefeng Wang , Palmer Dabbelt , Heiko Carstens , Jarkko Sakkinen , Atish Patra , Will Deacon , Masahiro Yamada , Nayna Jain , Krzysztof Kozlowski , Christian Borntraeger , Sami Tolvanen , Mao Han , Marco Elver , Kees Cook , Arnd Bergmann , "Steven Rostedt \(VMware\)" , Babu Moger , Russell King , Ben Dooks , Peter Collingbourne , Tiezhu Yang , Thomas Bogendoerfer , "open list:PARISC ARCHITECTURE" , Jessica Yu , "open list:BPF JIT for MIPS 32-BIT AND 64-BIT" , Thiago Jung Bauermann , Peter Zijlstra , "open list:SPARC + UltraSPARC sparc/sparc64" , "H. Peter Anvin" , Amit Daniel Kachhap , "open list:LIVE PATCHING" , "open list:RISC-V ARCHITECTURE" , Miroslav Benes , Jiri Olsa , Ard Biesheuvel , Vincenzo Frascino , Anders Roxell , Sven Schnelle , Mike Rapoport , "Paul E. McKenney" , Frederic Weisbecker , Paul Walmsley , KP Singh , Gerald Schaefer , Josh Poimboeuf , "open list:BPF JIT for MIPS 32-BIT AND 64-BIT" , "open list:MIPS" , Sergey Senozhatsky , "open list:LINUX FOR POWERPC 32-BIT AND 64-BIT" Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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