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:14:55 +0000 (15:14 -0400)
commit26d46aebe30e144269e0db41bd4e2b5d96093414
treec2e0d44226e308723a159aafc06997b24be1dd0e
parent4667f7f663bcf3e8ec315fc7965893aeabd64e95
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.025843 seconds and 4 git commands to generate.