Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1611584
| From | Masami Hiramatsu <mhiramat@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC PATCH tip/master 3/3] kprobes: Limit kretprobe maximum instances |
| Date | 2017-03-29 07:30 +0200 |
| Message-ID | <tqelc-2ha-5@gated-at.bofh.it> (permalink) |
| References | <tqelb-2ha-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Limit kretprobe maximum instance up to MAXACTIVE_ALLOC.
Without this limit, kretprobe user can specify huge number
(e.g. forget to zero-fill struct kretprobe) to maxactive
and may cause out-of-memory.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
kernel/kprobes.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 75c5390..f1bebcf 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1942,6 +1942,9 @@ int register_kretprobe(struct kretprobe *rp)
rp->kp.break_handler = NULL;
/* Pre-allocate memory for max kretprobe instances */
+ if (rp->maxactive > KRETPROBE_MAXACTIVE_ALLOC)
+ return -E2BIG;
+
if (rp->maxactive <= 0) {
#ifdef CONFIG_PREEMPT
rp->maxactive = max_t(unsigned int, 10, 2*num_possible_cpus());
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH tip/master 0/3] kprobes: tracing: kretprobe_instance dynamic allocation Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-29 07:30 +0200
[RFC PATCH tip/master 3/3] kprobes: Limit kretprobe maximum instances Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-29 07:30 +0200
[RFC PATCH tip/master 2/3] kprobes: Allocate kretprobe instance if its free list is empty Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-29 07:30 +0200
Re: [RFC PATCH tip/master 2/3] kprobes: Allocate kretprobe instance if its free list is empty Ingo Molnar <mingo@kernel.org> - 2017-03-29 08:40 +0200
Re: [RFC PATCH tip/master 2/3] kprobes: Allocate kretprobe instance if its free list is empty Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-29 10:30 +0200
Re: [RFC PATCH tip/master 2/3] kprobes: Allocate kretprobe instance if its free list is empty Josh Stone <jistone@redhat.com> - 2017-03-29 19:30 +0200
Re: [RFC PATCH tip/master 2/3] kprobes: Allocate kretprobe instance if its free list is empty Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-30 02:40 +0200
Re: [RFC PATCH tip/master 2/3] kprobes: Allocate kretprobe instance if its free list is empty Ingo Molnar <mingo@kernel.org> - 2017-03-30 09:00 +0200
Re: [RFC PATCH tip/master 2/3] kprobes: Allocate kretprobe instance if its free list is empty Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-30 15:10 +0200
Re: [RFC PATCH tip/master 2/3] kprobes: Allocate kretprobe instance if its free list is empty Alban Crequy <alban@kinvolk.io> - 2017-03-30 15:10 +0200
Re: [RFC PATCH tip/master 0/3] kprobes: tracing: kretprobe_instance dynamic allocation fche@redhat.com (Frank Ch. Eigler) - 2017-03-29 15:30 +0200
csiph-web