Re: [PATCH] kprobes: Enable tracing for mololithic kernel images
From: "hch@lst.de" <hch@lst.de>
Date: 2022-06-15 06:37:23
Also in:
linux-mips, linux-modules, linux-riscv, linux-s390, lkml, sparclinux
luxnic.net" [off-list ref], "ebiederm@xmission.com" [off-list ref], "aneesh.kumar@linux.ibm.com" [off-list ref], "Edgecombe, Rick P" [off-list ref], "bristot@redhat.com" [off-list ref], "wangkefeng.wang@huawei.com" [off-list ref], "kernel@esmil.dk" [off-list ref], "jniethe5@gmail.com" [off-list ref], "paul.walmsley@sifive.com" [off-list ref], "ast@kernel.org" [off-list ref], "will@kernel.org" [off-list ref], "masahiroy@kernel.org" [off-list ref], "Sakkinen, Jarkko" [off-list ref], "samitolvanen@google.com" [off-list ref], "naveen.n.rao@linux.ibm.com" [off-list ref], "elver@google.com" [off-list ref], "keescook@chromium.org" [off-list ref], "rostedt@goodmis.org" [off-list ref], "nathan@kernel.org" [off-list ref], "rmk+kernel@armlinux.org.uk" [off-list ref], "broonie@kernel.org" [off-list ref], "bp@alien8.de" <bp@alie n8.de>, "egorenar@linux.ibm.com" [off-list ref], "tsbogend@alpha.franken.de" [off-list ref], "linux-parisc@vger.kernel.org" [off-list ref], "nathaniel@profian.com" [off-list ref], "dmitry.torokhov@gmail.com" [off-list ref], "davem@davemloft.net" [off-list ref], "kirill.shutemov@linux.intel.com" [off-list ref], "huschle@linux.ibm.com" [off-list ref], "peterz@infradead.org" [off-list ref], "hpa@zytor.com" [off-list ref], "sparclinux@vger.kernel.org" [off-list ref], "yangtiezhu@loongson.cn" [off-list ref], "mbenes@suse.cz" [off-list ref], "chenzhongjin@huawei.com" [off-list ref], "ardb@kernel.org" [off-list ref], "x86@kernel.org" [off-list ref], "linux@armlinux.org.uk" [off-list ref], "linux-riscv@lists.infradead.org" [off-list ref], "mingo@redhat.com" [off-list ref], "atomlin@redhat.com" [off-list ref], "aou@eecs.berkeley.edu" [off-list ref], "hc a@linux.ibm.com" [off-list ref], "liaochang1@huawei.com" [off-list ref], "atishp@atishpatra.org" [off-list ref], "jpoimboe@kernel.org" [off-list ref], "tmricht@linux.ibm.com" [off-list ref], "linux-mips@vger.kernel.org" [off-list ref], "changbin.du@intel.com" [off-list ref], "palmer@dabbelt.com" [off-list ref], "linuxppc-dev@lists.ozlabs.org" [off-list ref], "linux-modules@vger.kernel.org" [off-list ref] Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" [off-list ref] On Tue, Jun 14, 2022 at 03:32:38PM +0300, jarkko@kernel.org wrote:
quoted
Like say for a next step we moved prog pack out of bpf into core code, gave it it's own copy of module_alloc(), and then made kprobes use it. Then we would have something with improved W^X guard rails, and kprobes would not depend on modules anymore. I think maybe it's a step in the right direction, even if it's not perfect.So you're saying that I should (as a first step) basically clone module_alloc() implementation for kprobes, and future for BPF use, in order to get a clean starting point?
I don't think cloning the code helps anyone. The fact that except for the eBPF mess everyone uses module_alloc and the related infrastructure is a feature and not a bug. The interface should become better than what we have right now, but there is few enough users that this can be done in one go. So assuming we really care deeply enough about fancy tracing without modules (and I'm not sure we do, even if you don't use modules it doesn't hurt to just build the modules code, I do that all the time for my test machines), the general approach in your series is the right one.