Masami Hiramatsu 6bbfa44116 kprobes: Limit max data_size of the kretprobe instances
The 'kprobe::data_size' is unsigned, thus it can not be negative.  But if
user sets it enough big number (e.g. (size_t)-8), the result of 'data_size
+ sizeof(struct kretprobe_instance)' becomes smaller than sizeof(struct
kretprobe_instance) or zero. In result, the kretprobe_instance are
allocated without enough memory, and kretprobe accesses outside of
allocated memory.

To avoid this issue, introduce a max limitation of the
kretprobe::data_size. 4KB per instance should be OK.

Link: https://lkml.kernel.org/r/163836995040.432120.10322772773821182925.stgit@devnote2

Cc: stable@vger.kernel.org
Fixes: f47cd9b553aa ("kprobes: kretprobe user entry-handler")
Reported-by: zhangyue <zhangyue1@kylinos.cn>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2021-12-01 21:04:34 -05:00
..
2021-11-09 10:56:41 -08:00
2021-10-19 17:27:05 +02:00
2021-11-01 20:05:19 -07:00
2021-11-18 10:50:45 -08:00
2021-11-01 20:25:38 -07:00
2021-11-01 21:17:39 -07:00
\n
2021-11-06 16:43:20 -07:00
2021-11-01 21:17:39 -07:00
2021-11-01 21:17:39 -07:00
2021-08-11 13:11:12 -07:00
2021-09-08 15:32:35 -07:00
2021-11-09 10:02:51 -08:00
2021-06-18 11:43:08 +02:00
2021-09-08 15:32:34 -07:00
2021-05-07 00:26:33 -07:00
2021-11-01 20:05:19 -07:00
2021-10-14 13:29:18 +02:00
2021-06-18 11:43:09 +02:00
2021-10-07 13:51:11 +02:00
2021-05-07 00:26:34 -07:00