From: Mathieu Desnoyers Date: Tue, 27 Sep 2022 20:31:29 +0000 (-0400) Subject: Fix: handle capture page faults as skip field X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=95ab0b458d258f604de7a1ef387e4be0d1c7ceb5;p=lttng-modules.git Fix: handle capture page faults as skip field Now that we have the appropriate save/restore position mechanism for error handling in place, we can handle page faults on copy-from-user by skipping the offending captured field entirely rather than relying on an empty string. Signed-off-by: Mathieu Desnoyers Change-Id: Ibe1e818f57f8218d2b83281a572895884fc28b86 --- diff --git a/src/lib/msgpack/msgpack.c b/src/lib/msgpack/msgpack.c index b9bac85f..54d56926 100644 --- a/src/lib/msgpack/msgpack.c +++ b/src/lib/msgpack/msgpack.c @@ -130,10 +130,7 @@ static inline int lttng_msgpack_append_user_buffer( } if (lttng_copy_from_user_check_nofault(writer->write_pos, ubuf, length)) { - /* - * After a successful strlen user, a page fault on copy is handled by - * considering the string as empty, returning a success. - */ + ret = -1; goto end; } writer->write_pos += length; @@ -444,12 +441,6 @@ int lttng_msgpack_write_user_str(struct lttng_msgpack_writer *writer, goto end; } - /* - * Handle empty string and strlen user page fault as empty string. - */ - if (length == 1) - return lttng_msgpack_write_str(writer, ""); - if (length <= MSGPACK_FIXSTR_MAX_LENGTH) ret = lttng_msgpack_encode_user_fixstr(writer, ustr, length); else