[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181011233117.7883-8-rick.p.edgecombe@intel.com>
Date: Thu, 11 Oct 2018 16:31:17 -0700
From: Rick Edgecombe <rick.p.edgecombe@...el.com>
To: kernel-hardening@...ts.openwall.com, daniel@...earbox.net,
keescook@...omium.org, catalin.marinas@....com,
will.deacon@....com, davem@...emloft.net, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, x86@...nel.org, arnd@...db.de,
jeyu@...nel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-mips@...ux-mips.org,
linux-s390@...r.kernel.org, sparclinux@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-arch@...r.kernel.org
Cc: kristen@...ux.intel.com, dave.hansen@...el.com,
arjan@...ux.intel.com, deneen.t.dock@...el.com,
Rick Edgecombe <rick.p.edgecombe@...el.com>
Subject: [PATCH v2 7/7] s390/modules: Add rlimit checking for s390 modules
This adds in the rlimit checking for the s390 module allocator.
This has not been tested.
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
---
arch/s390/kernel/module.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index d298d3cb46d0..6c2356a72b63 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -32,12 +32,22 @@
void *module_alloc(unsigned long size)
{
+ void *p;
+
if (PAGE_ALIGN(size) > MODULES_LEN)
return NULL;
- return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
+
+ if (check_inc_mod_rlimit(size))
+ return NULL;
+
+ p = __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
GFP_KERNEL, PAGE_KERNEL_EXEC,
0, NUMA_NO_NODE,
__builtin_return_address(0));
+
+ update_mod_rlimit(p, size);
+
+ return p;
}
void module_arch_freeing_init(struct module *mod)
--
2.17.1
Powered by blists - more mailing lists