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:53 +0000 (10:29 -0400)
commit72b13183e01b58acb1069396d518dd8ecb586af4
tree38bbcfee5787f3097805d42f66c1b4d900b4416d
parent4643974cf0ad13879570d2cafc898215c54acfa2
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.0252289999999999 seconds and 4 git commands to generate.