From: Mathieu Desnoyers Date: Tue, 9 Sep 2014 12:32:29 +0000 (-0400) Subject: syscall instrumentation: handle copy_from_user return value X-Git-Tag: v2.6.0-rc1~39 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b43aa94e8a0725ff0c8fa44da0b7d0ec5e1ae89b;p=lttng-modules.git syscall instrumentation: handle copy_from_user return value Signed-off-by: Mathieu Desnoyers --- diff --git a/instrumentation/syscalls/headers/x86-64-syscalls-3.10.0-rc7_pointers_override.h b/instrumentation/syscalls/headers/x86-64-syscalls-3.10.0-rc7_pointers_override.h index 7a8812c6..5e402a5a 100644 --- a/instrumentation/syscalls/headers/x86-64-syscalls-3.10.0-rc7_pointers_override.h +++ b/instrumentation/syscalls/headers/x86-64-syscalls-3.10.0-rc7_pointers_override.h @@ -29,9 +29,10 @@ SC_LTTNG_TRACEPOINT_EVENT_CODE(connect, if (addrlen < sizeof(struct sockaddr_in6)) goto skip_code; (void) get_user(tp_locvar->dport, &((struct sockaddr_in6 *) uservaddr)->sin6_port); - (void) copy_from_user(tp_locvar->v6addr, + if (copy_from_user(tp_locvar->v6addr, &((struct sockaddr_in6 *) uservaddr)->sin6_addr.in6_u.u6_addr8, - sizeof(tp_locvar->v6addr)); + sizeof(tp_locvar->v6addr))) + memset(tp_locvar->v6addr, 0, sizeof(tp_locvar->v6addr)); tp_locvar->v6addr_len = 8; break; } @@ -94,9 +95,10 @@ SC_LTTNG_TRACEPOINT_EVENT_CODE(accept, if (tp_locvar->uaddr_len < sizeof(struct sockaddr_in6)) goto skip_code; (void) get_user(tp_locvar->sport, &((struct sockaddr_in6 *) upeer_sockaddr)->sin6_port); - (void) copy_from_user(tp_locvar->v6addr, + if (copy_from_user(tp_locvar->v6addr, &((struct sockaddr_in6 *) upeer_sockaddr)->sin6_addr.in6_u.u6_addr8, - sizeof(tp_locvar->v6addr)); + sizeof(tp_locvar->v6addr))) + memset(tp_locvar->v6addr, 0, sizeof(tp_locvar->v6addr)); tp_locvar->v6addr_len = 8; break; }