From: Peter Zijlstra <peterz@infradead.org>
To: Song Liu <songliubraving@fb.com>
Cc: Song Liu <song@kernel.org>, bpf <bpf@vger.kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>,
"linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>,
Luis Chamberlain <mcgrof@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Masami Hiramatsu <mhiramat@kernel.org>,
"naveen.n.rao@linux.ibm.com" <naveen.n.rao@linux.ibm.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"anil.s.keshavamurthy@intel.com" <anil.s.keshavamurthy@intel.com>,
"keescook@chromium.org" <keescook@chromium.org>,
"hch@infradead.org" <hch@infradead.org>,
"dave@stgolabs.net" <dave@stgolabs.net>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
Kernel Team <Kernel-team@fb.com>,
"x86@kernel.org" <x86@kernel.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"rick.p.edgecombe@intel.com" <rick.p.edgecombe@intel.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH bpf-next 1/3] mm/vmalloc: introduce vmalloc_exec which allocates RO+X memory
Date: Thu, 14 Jul 2022 12:10:36 +0200 [thread overview]
Message-ID: <Ys/rnFf/ewPA85Iz@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <78A18945-0841-4CCE-8A33-6C09ECBFF7E1@fb.com>
On Wed, Jul 13, 2022 at 09:20:55PM +0000, Song Liu wrote:
>
>
> > On Jul 13, 2022, at 1:26 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > On Wed, Jul 13, 2022 at 03:48:35PM +0000, Song Liu wrote:
> >
> >>> So how about instead we separate them? Then much of the problem goes
> >>> away, you don't need to track these 2M chunks at all.
> >>
> >> If we manage the memory in < 2MiB granularity, either 4kB or smaller,
> >> we still need some way to track which parts are being used, no? I mean
> >> the bitmap.
> >
> > I was thinking the vmalloc vmap_area tree could help out there.
>
> Interesting. vmap_area tree indeed keeps a lot of useful information.
>
> Currently, powerpc supports CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC,
Only PPC32; and it's due to a constraint in their MMU vs page
protections.
> which leaves module_alloc just for module text. If this works, we get
> separation between RO+X and RW memory. What would it take to enable
> CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC for x86_64?
The VM_TOPDOWN_VMAP flag and ensuring the data and code regions never
overlap. Once you have that you can enable it.
Specifically the problem is that data needs to be in the s32 immediate
range just like code, so we're constrained to the module range. Given
that constraint, the easiest solution is to use the different ends of
that range.
next prev parent reply other threads:[~2022-07-14 10:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220713071846.3286727-1-song@kernel.org>
[not found] ` <20220713071846.3286727-2-song@kernel.org>
2022-07-13 9:53 ` Peter Zijlstra
2022-07-13 10:08 ` Christoph Hellwig
2022-07-13 15:49 ` Song Liu
2022-07-14 4:23 ` Christoph Hellwig
2022-07-14 4:54 ` Song Liu
2022-07-14 18:15 ` Uladzislau Rezki
2022-07-15 0:24 ` Song Liu
2022-07-13 10:20 ` Peter Zijlstra
2022-07-13 15:48 ` Song Liu
2022-07-13 20:26 ` Peter Zijlstra
2022-07-13 21:20 ` Song Liu
2022-07-14 10:10 ` Peter Zijlstra [this message]
2022-07-14 5:16 ` Christoph Hellwig
2022-07-14 7:26 ` Peter Zijlstra
2022-08-05 5:29 ` Song Liu
2022-08-05 5:29 ` Song Liu
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=Ys/rnFf/ewPA85Iz@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Kernel-team@fb.com \
--cc=akpm@linux-foundation.org \
--cc=anil.s.keshavamurthy@intel.com \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dave.hansen@linux.intel.com \
--cc=dave@stgolabs.net \
--cc=davem@davemloft.net \
--cc=hch@infradead.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=naveen.n.rao@linux.ibm.com \
--cc=rick.p.edgecombe@intel.com \
--cc=rostedt@goodmis.org \
--cc=song@kernel.org \
--cc=songliubraving@fb.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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