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>
Wed, 12 May 2021 14:29:50 +0000 (10:29 -0400)
commit30cddf693eea0129b25c9761db6b202ddef549b3
tree0a404102fc6df6e8a4030d9302fdbc49aa89e81e
parent4733b9ab0c355a3563af31d879356702710612b7
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
lib/ringbuffer/backend.h
This page took 0.02551 seconds and 4 git commands to generate.