* [PATCH] module: do not print allocation-fail warning on bogus user buffer size
@ 2015-02-16 11:23 Kirill A. Shutemov
2015-02-16 23:55 ` Rusty Russell
0 siblings, 1 reply; 2+ messages in thread
From: Kirill A. Shutemov @ 2015-02-16 11:23 UTC (permalink / raw)
To: Rusty Russell; +Cc: linux-kernel, Kirill A. Shutemov, Dave Jones, Sasha Levin
init_module(2) passes user-specified buffer length directly to
vmalloc(). It makes warn_alloc_failed() to print out a lot of info into
dmesg if user specified insane size, like -1.
Let's silence the warning. It doesn't add much value to -ENOMEM return
code. Without the patch the syscall is prohibitive noisy for testing
with trinity.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Sasha Levin <sasha.levin@oracle.com>
---
kernel/module.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/module.c b/kernel/module.c
index b34813f725e9..f63e5e8f3385 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2494,7 +2494,8 @@ static int copy_module_from_user(const void __user *umod, unsigned long len,
return err;
/* Suck in entire file: we'll want most of it. */
- info->hdr = vmalloc(info->len);
+ info->hdr = __vmalloc(info->len,
+ GFP_KERNEL | __GFP_HIGHMEM | __GFP_NOWARN, PAGE_KERNEL);
if (!info->hdr)
return -ENOMEM;
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] module: do not print allocation-fail warning on bogus user buffer size
2015-02-16 11:23 [PATCH] module: do not print allocation-fail warning on bogus user buffer size Kirill A. Shutemov
@ 2015-02-16 23:55 ` Rusty Russell
0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2015-02-16 23:55 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: linux-kernel, Kirill A. Shutemov, Dave Jones, Sasha Levin
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> writes:
> init_module(2) passes user-specified buffer length directly to
> vmalloc(). It makes warn_alloc_failed() to print out a lot of info into
> dmesg if user specified insane size, like -1.
>
> Let's silence the warning. It doesn't add much value to -ENOMEM return
> code. Without the patch the syscall is prohibitive noisy for testing
> with trinity.
Heh, we used to have an explicit length check because vmalloc would
BUG(). So I guess this is progress...
Applied thanks,
Rusty.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-16 23:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-16 11:23 [PATCH] module: do not print allocation-fail warning on bogus user buffer size Kirill A. Shutemov
2015-02-16 23:55 ` Rusty Russell
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).