|
Message-ID: <a89e6d7bbcfba2ebaad927fac0da131ded59aa28.camel@intel.com> Date: Fri, 12 Oct 2018 22:01:45 +0000 From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com> To: "jeyu@...nel.org" <jeyu@...nel.org>, "Hansen, Dave" <dave.hansen@...el.com> CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "daniel@...earbox.net" <daniel@...earbox.net>, "keescook@...omium.org" <keescook@...omium.org>, "linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>, "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>, "arjan@...ux.intel.com" <arjan@...ux.intel.com>, "tglx@...utronix.de" <tglx@...utronix.de>, "linux-mips@...ux-mips.org" <linux-mips@...ux-mips.org>, "Dock, Deneen T" <deneen.t.dock@...el.com>, "x86@...nel.org" <x86@...nel.org>, "kristen@...ux.intel.com" <kristen@...ux.intel.com>, "catalin.marinas@....com" <catalin.marinas@....com>, "mingo@...hat.com" <mingo@...hat.com>, "will.deacon@....com" <will.deacon@....com>, "kernel-hardening@...ts.openwall.com" <kernel-hardening@...ts.openwall.com>, "bp@...en8.de" <bp@...en8.de>, "linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>, "davem@...emloft.net" <davem@...emloft.net>, "arnd@...db.de" <arnd@...db.de>, "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>, "sparclinux@...r.kernel.org" <sparclinux@...r.kernel.org> Subject: Re: [PATCH v2 4/7] arm64/modules: Add rlimit checking for arm64 modules On Fri, 2018-10-12 at 16:32 +0200, Jessica Yu wrote: > +++ Dave Hansen [11/10/18 16:47 -0700]: > > On 10/11/2018 04:31 PM, Rick Edgecombe wrote: > > > + if (check_inc_mod_rlimit(size)) > > > + return NULL; > > > + > > > p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base, > > > module_alloc_base + MODULES_VSIZE, > > > gfp_mask, PAGE_KERNEL_EXEC, 0, > > > @@ -65,6 +68,8 @@ void *module_alloc(unsigned long size) > > > return NULL; > > > } > > > > > > + update_mod_rlimit(p, size); > > > > Is there a reason we couldn't just rename all of the existing per-arch > > module_alloc() calls to be called, say, "arch_module_alloc()", then put > > this new rlimit code in a generic helper that does: > > > > > > if (check_inc_mod_rlimit(size)) > > return NULL; > > > > p = arch_module_alloc(...); > > > > ... > > > > update_mod_rlimit(p, size); > > > > I second this suggestion. Just make module_{alloc,memfree} generic, > non-weak functions that call the rlimit helpers in addition to the > arch-specific arch_module_{alloc,memfree} functions. > > Jessica Ok, thanks. I am going to try another version of this with just a system wide BPF JIT limit based on the problems Jann brought up. I think it would be nice to have a module space limit, but as far as I know the only way today un-privlidged users could fill the space is from BPF JIT. Unless you see another purpose long term? Rick
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.