Skip to contentSkip to conversation

Fix: copy_from_user size when limited allocation

PATCH Mathieu Desnoyers 1 participant 1 message May 2, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Mathieu Desnoyers

author Applied
#1 lore raw

merged into master, thanks!

Mathieu

Quoted 34 lines · ----- On May 2, 2016, at 4:48 PM, Julien Desfossez [email protected]…

We restrict the memory allocation to one page, but in two syscalls we were using the wrong size in the copy_from_user.

---
instrumentation/syscalls/headers/syscalls_pointers_override.h | 5 ++---

1 file changed, 2 insertions(+), 3 deletions(-)
instrumentation/syscalls/headers/syscalls_pointers_override.h +2 -4
index dd6f954..4a69fc3 100644
@@ -418,8 +418,7 @@ static struct lttng_type lttng_pollfd_elem = {
 		if (!tp_locvar->fds)							\
 			goto error;							\
 		err = lib_ring_buffer_copy_from_user_check_nofault(			\
-			tp_locvar->fds, ufds,						\
-			nfds * sizeof(struct pollfd));					\
+			tp_locvar->fds, ufds, tp_locvar->alloc_fds);			\
 		if (err != 0)								\
 			goto error;							\
 	}										\
@@ -772,7 +771,7 @@ static struct lttng_type lttng_epoll_wait_elem = {
 										\
 		err = lib_ring_buffer_copy_from_user_check_nofault(		\
 			tp_locvar->events, uevents,				\
-			maxevents * sizeof(struct epoll_event));		\
+			maxalloc * sizeof(struct epoll_event));			\
 		if (err != 0)							\
 			tp_locvar->fds_length = 0;				\
 	}									\
--

1.9.1

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev