[lttng-dev] Bulletproof RCU arena resize bug

Milosz Tanski milosz at adfin.com
Mon Sep 30 11:16:37 EDT 2013


While trying to use the BP flavor of RCU I ran into random crashes. I
tracked it down to issues with resizing of the BP RCU memory pool.

The problem is in the urcu-bp.c file in the resize_arena() function.
On successful allocation / remapping the len member of the
registry_arena struct is never set anywhere function. On the second
resize of the arena the code in resize_arena() still thinks the
previous size is equal to the original mapping size. I've fixed this
issue locally by just adding the following code at the bottom of

I hope this helps,
- Milosz

diff --git a/urcu-bp.c b/urcu-bp.c
index a823659..d26dcc7 100644
--- a/urcu-bp.c
+++ b/urcu-bp.c
@@ -325,6 +329,7 @@ static void resize_arena(struct registry_arena
*arena, size_t len)

        bzero(new_arena + arena->len, len - arena->len);
        arena->p = new_arena;
+       arena->len = len;

 /* Called with signals off and mutex locked */

More information about the lttng-dev mailing list