Fix: increment buffer offset when failing to copy from user-space
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 7 May 2021 19:03:04 +0000 (15:03 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 11 May 2021 19:15:04 +0000 (15:15 -0400)
commit8c539f50131560ca89109b211a8ce52ecc260e16
treefb1265d2aa284d4492b2451c7d969838a2997b82
parente85d1a7fd1e803bf700cc0cd7ddf97e52f1db5ea
Fix: increment buffer offset when failing to copy from user-space

Upon failure to copy from user-space due to failing access ok check, the
ring buffer offset is not incremented, which could generate unreadable
traces because we don't account for the padding we write into the ring
buffer.

Note that this typically won't affect a common use-case of copying
strings from user-space, because unless mprotect is invoked within a
narrow race window (between user strlen and user strcpy), the strlen
will fail on access ok when calculating the space to reserve, which will
match what happens on strcpy.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic4d9487dd8870a526bae3023bb80f5e6301cec50
include/ringbuffer/backend.h
This page took 0.027359 seconds and 4 git commands to generate.