Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] question about  rcu_bp_exit()
Date: Wed, 18 May 2016 18:40:03 +0000 (UTC)	[thread overview]
Message-ID: <971830834.12745.1463596803434.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <6db07fb4.c6e5.154c340296f.Coremail.songxin_1980@126.com>

----- On May 18, 2016, at 5:44 AM, songxin <songxin_1980 at 126.com> wrote: 

> Hi,
> Now I get a crash because receiving signal SIGSEGV as below.

> #0 arena_alloc (arena=<optimized out>) at
> /usr/src/debug/liburcu/0.9.1+git5fd33b1e5003ca316bd314ec3fd1447f6199a282-r0/git/urcu-bp.c:432
> #1 add_thread () at
> /usr/src/debug/liburcu/0.9.1+git5fd33b1e5003ca316bd314ec3fd1447f6199a282-r0/git/urcu-bp.c:462
> #2 rcu_bp_register () at
> /usr/src/debug/liburcu/0.9.1+git5fd33b1e5003ca316bd314ec3fd1447f6199a282-r0/git/urcu-bp.c:541

> I read the code of urcu-bp.c and found that "if (chunk->data_len - chunk->used <
> len)" is in 432 line. So I guess that the chunk is a illegal pointer.
> Below is the function rcu_bp_exit().

> static
> void rcu_bp_exit(void)
> {
> mutex_lock(&init_lock);
> if (!--rcu_bp_refcount) {
> struct registry_chunk *chunk, *tmp;
> int ret;

> cds_list_for_each_entry_safe(chunk, tmp,
> &registry_arena.chunk_list, node) {
> munmap(chunk, chunk->data_len
> + sizeof(struct registry_chunk));
> }
> ret = pthread_key_delete(urcu_bp_key);
> if (ret)
> abort();
> }
> mutex_unlock(&init_lock);
> }

> My question is below.
> Why did not delete the chunk from registry_arena.chunk_list before munmap a
> chunk?

It is not expected that any thread would be created after the execution of 
rcu_bp_exit() as a library destructor. Does re-initializing the chunk_list after 
iterating on it within rcu_bp_exit() fix your issue ? 

I'm curious about your use-case for creating threads after the library destructor 
has run. 

Thanks, 

Mathieu 

> Thanks,
> xin

> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers 
EfficiOS Inc. 
http://www.efficios.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20160518/5c64b2ef/attachment.html>


       reply	other threads:[~2016-05-18 18:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6db07fb4.c6e5.154c340296f.Coremail.songxin_1980@126.com>
2016-05-18 18:40 ` Mathieu Desnoyers [this message]
2016-05-19 19:53   ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=971830834.12745.1463596803434.JavaMail.zimbra@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox