linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "hch@lst.de" <hch@lst.de>,
	"christophe.leroy@csgroup.eu" <christophe.leroy@csgroup.eu>,
	"mcgrof@kernel.org" <mcgrof@kernel.org>
Cc: "svens@linux.ibm.com" <svens@linux.ibm.com>,
	"palmer@dabbelt.com" <palmer@dabbelt.com>,
	"jpoimboe@kernel.org" <jpoimboe@kernel.org>,
	"paulus@samba.org" <paulus@samba.org>,
	"zepan@sipeed.com" <zepan@sipeed.com>,
	"iii@linux.ibm.com" <iii@linux.ibm.com>,
	"deller@gmx.de" <deller@gmx.de>,
	"aou@eecs.berkeley.edu" <aou@eecs.berkeley.edu>,
	"joey.gouly@arm.com" <joey.gouly@arm.com>,
	"anemo@mba.ocn.ne.jp" <anemo@mba.ocn.ne.jp>,
	"egorenar@linux.ibm.com" <egorenar@linux.ibm.com>,
	"ast@kernel.org" <ast@kernel.org>,
	"ardb@kernel.org" <ardb@kernel.org>,
	"mpe@ellerman.id.au" <mpe@ellerman.id.au>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
	"npiggin@gmail.com" <npiggin@gmail.com>,
	"thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
	"bp@alien8.de" <bp@alien8.de>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"x86@kernel.org" <x86@kernel.org>,
	"luis.machado@linaro.org" <luis.machado@linaro.org>,
	"ebiederm@xmission.com" <ebiederm@xmission.com>,
	"mbenes@suse.cz" <mbenes@suse.cz>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"jniethe5@gmail.com" <jniethe5@gmail.com>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"paul.walmsley@sifive.com" <paul.walmsley@sifive.com>,
	"andreyknvl@gmail.com" <andreyknvl@gmail.com>,
	"dja@axtens.net" <dja@axtens.net>,
	"liaochang1@huawei.com" <liaochang1@huawei.com>,
	"linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>,
	"huschle@linux.ibm.com" <huschle@linux.ibm.com>,
	"will@kernel.org" <will@kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"James.Bottomley@hansenpartnership.com" 
	<James.Bottomley@hansenpartnership.com>,
	"song@kernel.org" <song@kernel.org>,
	"guoren@kernel.org" <guoren@kernel.org>,
	"nathan@kernel.org" <nathan@kernel.org>,
	"dave.anglin@bell.net" <dave.anglin@bell.net>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"atomlin@redhat.com" <atomlin@redhat.com>,
	"bristot@redhat.com" <bristot@redhat.com>,
	"naveen.n.rao@linux.ibm.com" <naveen.n.rao@linux.ibm.com>,
	"anup@brainfault.org" <anup@brainfault.org>,
	"javierm@redhat.com" <javierm@redhat.com>,
	"linux@roeck-us.net" <linux@roeck-us.net>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"philipp.tomsich@vrull.eu" <philipp.tomsich@vrull.eu>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"ndesaulniers@google.com" <ndesaulniers@google.com>,
	"samitolvanen@google.com" <samitolvanen@google.com>,
	"yangtiezhu@loongson.cn" <yangtiezhu@loongson.cn>,
	"aneesh.kumar@linux.ibm.com" <aneesh.kumar@linux.ibm.com>,
	"geert@linux-m68k.org" <geert@linux-m68k.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"heiko@sntech.de" <heiko@sntech.de>,
	"nathaniel@profian.com" <nathaniel@profian.com>,
	"michael.roth@amd.com" <michael.roth@amd.com>,
	"rmk+kernel@armlinux.org.uk" <rmk+kernel@armlinux.org.uk>,
	"Sakkinen, Jarkko" <jarkko@profian.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"borntraeger@linux.ibm.com" <borntraeger@linux.ibm.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"wangkefeng.wang@huawei.com" <wangkefeng.wang@huawei.com>,
	"tmricht@linux.ibm.com" <tmricht@linux.ibm.com>,
	"hca@linux.ibm.com" <hca@linux.ibm.com>,
	"jarkko@kernel.org" <jarkko@kernel.org>,
	"linux-parisc@vger.kernel.org" <linux-parisc@vger.kernel.org>,
	"gor@linux.ibm.com" <gor@linux.ibm.com>,
	"atishp@atishpatra.org" <atishp@atishpatra.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"dmitry.torokhov@gmail.com" <dmitry.torokhov@gmail.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	"sparclinux@vger.kernel.org" <sparclinux@vger.kernel.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"tsbogend@alpha.franken.de" <tsbogend@alpha.franken.de>,
	"nico@fluxnic.net" <nico@fluxnic.net>,
	"masahiroy@kernel.org" <masahiroy@kernel.org>,
	"agordeev@linux.ibm.com" <agordeev@linux.ibm.com>,
	"kernel@esmil.dk" <kernel@esmil.dk>,
	"ashimida@linux.alibaba.com" <ashimida@linux.alibaba.com>,
	"elver@google.com" <elver@google.com>,
	"keescook@chromium.org" <keescook@chromium.org>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"mhiramat@kernel.org" <mhiramat@kernel.org>,
	"Keshavamurthy, Anil S" <anil.s.keshavamurthy@intel.com>,
	"linux-riscv@lists.infradead.org"
	<linux-riscv@lists.infradead.org>,
	"chenzhongjin@huawei.com" <chenzhongjin@huawei.com>,
	"andrealmeid@igalia.com" <andrealmeid@igalia.com>,
	"changbin.du@intel.com" <changbin.du@intel.com>,
	"benh@kernel.crashing.org" <benh@kernel.crashing.org>,
	"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>
Subject: Re: [PATCH] kprobes: Enable tracing for mololithic kernel images
Date: Thu, 9 Jun 2022 18:41:36 +0000	[thread overview]
Message-ID: <e7dedb9086193ca7682edc10fabc4195894e5146.camel@intel.com> (raw)
In-Reply-To: <YqH0iEgsi6+bwS3x@bombadil.infradead.org>

On Thu, 2022-06-09 at 06:24 -0700, Luis Chamberlain wrote:
> On Thu, Jun 09, 2022 at 05:48:52AM +0200, Christoph Hellwig wrote:
> > On Wed, Jun 08, 2022 at 01:26:19PM -0700, Luis Chamberlain wrote:
> > > No, that was removed because it has only one user.
> > 
> > That is only part of the story.  The other part is that the overall
> > kernel simply does not have any business allocating exutable
> > memory.
> > Executable memory is a very special concept for modules or module-
> > like
> > code like kprobes, and should not be exposed as a general concept.
> 
> It is not just modules and kprobes, it is also ftrace and bpf too
> now.
> So while it should not be used everywhere calling it module_alloc()
> is just confusing at this point. Likewise, module_alloc_huge() is
> being proposed too and I'd rather we deal with this properly in
> aligment
> of taking care of the rename as well.
> 
> If the concern is to restrict access we can use the module namespace
> stuff
> so to ensure only intended users get access to it.

BPF even has multiple uses for text allocation. It has its own
trampoline feature that puts different type of text in the allocation,
with its own allocation routine. I looks like there are even more
little allocators in there.

So yea, there seems to be a lot of the kernel in the business of
dynamically generated text, for better or worse. I agree that it needs
to be done carefully. However, these usages always seem to have the
same problems (W^X, arch eccentricities, etc). So I don't think we
should hide away the pieces. Instead we should have something with
guard rails on it, so they can't get the allocation part wrong.

But I guess the question here is: what should we do in the meantime? It
is kind of similar to the questions that came up around the bpf prog
pack allocator. Should we hold up allocator related work until
underlying problems are resolved and there is some mature core
solution?

Personally I had thought we would need to do some clean switch to a
much different interface. I still think someday it will be required,
but it seems to be evolving naturally for the time being.

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.

  reply	other threads:[~2022-06-09 18:41 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 23:59 [PATCH] kprobes: Enable tracing for mololithic kernel images Jarkko Sakkinen
2022-06-08  2:35 ` Guo Ren
2022-06-08  5:25   ` Jarkko Sakkinen
2022-06-08 14:21     ` Masami Hiramatsu
2022-06-08 16:12       ` Song Liu
2022-06-08 18:20         ` Song Liu
2022-06-08 20:26           ` Luis Chamberlain
2022-06-09  3:48             ` Christoph Hellwig
2022-06-09 13:24               ` Luis Chamberlain
2022-06-09 18:41                 ` Edgecombe, Rick P [this message]
2022-06-09 22:48                   ` Song Liu
2022-06-14 12:32                   ` jarkko
2022-06-15  6:37                     ` hch
2022-06-15 21:29                       ` jarkko
2022-06-09 13:12         ` Jarkko Sakkinen
2022-06-09 13:23           ` Ard Biesheuvel
2022-06-12 12:18             ` Masami Hiramatsu
2022-06-14 10:54             ` Jarkko Sakkinen
     [not found]         ` <f7ff2a8d-4128-dac9-9768-1d98bfb06a06@csgroup.eu>
2022-06-09 22:23           ` Song Liu
2022-06-09 12:59       ` Jarkko Sakkinen
2022-06-08 16:27 ` Ard Biesheuvel
2022-06-08 18:19   ` Song Liu
2022-06-12 12:30     ` Masami Hiramatsu
2022-06-14 12:30       ` Jarkko Sakkinen
2022-06-09  5:37   ` Jarkko Sakkinen
2022-06-09  7:47 ` Russell King (Oracle)
2022-06-09 11:48   ` Jarkko Sakkinen
2022-06-09 13:44   ` Luis Chamberlain
2022-06-14 12:26     ` Jarkko Sakkinen
     [not found]       ` <144b7e90-5d75-7e2c-4e54-8a73f914dfdf@csgroup.eu>
2022-06-15 21:24         ` Jarkko Sakkinen
     [not found] ` <f2030fb4-4978-068b-6250-5bd5b2746675@csgroup.eu>
2022-06-09 12:57   ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7dedb9086193ca7682edc10fabc4195894e5146.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrealmeid@igalia.com \
    --cc=andreyknvl@gmail.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=ardb@kernel.org \
    --cc=ashimida@linux.alibaba.com \
    --cc=ast@kernel.org \
    --cc=atishp@atishpatra.org \
    --cc=atomlin@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=borntraeger@linux.ibm.com \
    --cc=bp@alien8.de \
    --cc=bristot@redhat.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=changbin.du@intel.com \
    --cc=chenzhongjin@huawei.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dave.anglin@bell.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=dja@axtens.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=egorenar@linux.ibm.com \
    --cc=elver@google.com \
    --cc=geert@linux-m68k.org \
    --cc=gor@linux.ibm.com \
    --cc=guoren@kernel.org \
    --cc=hca@linux.ibm.com \
    --cc=hch@lst.de \
    --cc=heiko@sntech.de \
    --cc=hpa@zytor.com \
    --cc=huschle@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=jarkko@kernel.org \
    --cc=jarkko@profian.com \
    --cc=javierm@redhat.com \
    --cc=jniethe5@gmail.com \
    --cc=joey.gouly@arm.com \
    --cc=jpoimboe@kernel.org \
    --cc=keescook@chromium.org \
    --cc=kernel@esmil.dk \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=liaochang1@huawei.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@roeck-us.net \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=luis.machado@linaro.org \
    --cc=mark.rutland@arm.com \
    --cc=masahiroy@kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mcgrof@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=michael.roth@amd.com \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=nathan@kernel.org \
    --cc=nathaniel@profian.com \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=ndesaulniers@google.com \
    --cc=nico@fluxnic.net \
    --cc=npiggin@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=philipp.tomsich@vrull.eu \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=rostedt@goodmis.org \
    --cc=samitolvanen@google.com \
    --cc=song@kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=tmricht@linux.ibm.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=wangkefeng.wang@huawei.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=yangtiezhu@loongson.cn \
    --cc=zepan@sipeed.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).