]> git.lttng.org Git - userspace-rcu.git/commit
Fix: handle reference count overflow
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 19 Jan 2016 20:23:01 +0000 (15:23 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 19 Jan 2016 20:30:09 +0000 (15:30 -0500)
commit7ce99d0278e87880d1382cdf791bb84f7b489ea4
treebdd8cbc3d51d7d06128882e373c6c8e97dccef0c
parentb2633d211b186cb201be327ded53ecf523ecf0bd
Fix: handle reference count overflow

The urcu refcounting API features a look and feel similar to the Linux
kernel reference counting API, which has been the subject of
CVE-2016-0728 (use-after-free). Therefore, improve the urcu refcounting
API by dealing with reference counting overflow.

For urcu_ref_get(), handle this by comparing the prior value with
LONG_MAX before updating it with a cmpxchg. When an overflow would
occur, trigger a abort() rather than allowing the overflow (which is a
use-after-free security concern).

For urcu_ref_get_unless_zero(), in addition to compare the prior value
to 0, also compare it to LONG_MAX, and return failure (false) in both
cases.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu/ref.h
This page took 0.029264 seconds and 4 git commands to generate.