# Re: \[PATCH\] kprobes: Enable tracing for mololithic kernel images

- From: jarkko@kernel.org \<jarkko@kernel.org\>
- Date: 2022-06-15 21:31:32 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2022/06/1823047
- Thread: https://ratatoskr.run/linux-mips/2022/06/1811301/t.md

```text
et>, "ebiederm@xmission.com" [ref], "aneesh.kumar@linux.ibm.com" [ref], "Edgecombe, Rick P" [ref], "bristot@redhat.com" [ref], "wangkefeng.wang@huawei.com" [ref], "kernel@esmil.dk" [ref], "jniethe5@gmail.com" [ref], "paul.walmsley@sifive.com" [ref], "ast@kernel.org" [ref], "will@kernel.org" [ref], "masahiroy@kernel.org" [ref], "Sakkinen, Jarkko" [ref], "samitolvanen@google.com" [ref], "naveen.n.rao@linux.ibm.com" [ref], "elver@google.com" [ref], "keescook@chromium.org" [ref], "rostedt@goodmis.org" [ref], "nathan@kernel.org" [ref], "rmk+kernel@armlinux.org.uk" [ref], "broonie@kernel.org" [ref], "bp@alien8.de" [ref], "egorenar@linux.ibm
 .com" [ref], "tsbogend@alpha.franken.de" [ref], "linux-parisc@vger.kernel.org" [ref], "nathaniel@profian.com" [ref], "dmitry.torokhov@gmail.com" [ref], "davem@davemloft.net" [ref], "kirill.shutemov@linux.intel.com" [ref], "huschle@linux.ibm.com" [ref], "peterz@infradead.org" [ref], "hpa@zytor.com" [ref], "sparclinux@vger.kernel.org" [ref], "yangtiezhu@loongson.cn" [ref], "mbenes@suse.cz" [ref], "chenzhongjin@huawei.com" [ref], "ardb@kernel.org" [ref], "x86@kernel.org" [ref], "linux@armlinux.org.uk" [ref], "linux-riscv@lists.infradead.org" [ref], "mingo@redhat.com" [ref], "atomlin@redhat.com" [ref], "aou@eecs.berkeley.edu" <a
 ou@eecs.berkeley.edu>, "hca@linux.ibm.com" <hca@linux
.ibm.com>, "liaochang1@huawei.com" [ref], "atishp@atishpatra.org" [ref], "jpoimboe@kernel.org" [ref], "tmricht@linux.ibm.com" [ref], "linux-mips@vger.kernel.org" [ref], "changbin.du@intel.com" [ref], "palmer@dabbelt.com" [ref], "linuxppc-dev@lists.ozlabs.org" [ref], "linux-modules@vger.kernel.org" [ref]
Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org
Sender: "Linuxppc-dev" [ref]

On Wed, Jun 15, 2022 at 08:37:07AM +0200, hch@lst.de wrote:
> On Tue, Jun 14, 2022 at 03:32:38PM +0300, jarkko@kernel.org wrote:
> > > 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.

OK, thanks for the elaboration!

However I bake it, I doubt that next version is going to be the final
version, given all the angles. Therefore, I mostly Christophe's
suggestions on compilation flags, and also split this into per-arch
patches.

That should be at least to the right direction.

BR, Jarkko
```
