All of lore.kernel.org
 help / color / mirror / Atom feed
* question about  rcu_bp_exit()
@ 2016-05-18 10:07 songxin
  0 siblings, 0 replies; 5+ messages in thread
From: songxin @ 2016-05-18 10:07 UTC (permalink / raw)
  To: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 1379 bytes --]

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?


Thanks,
xin






 





 

[-- Attachment #1.2: Type: text/html, Size: 3273 bytes --]

[-- Attachment #2: ATT00003.txt --]
[-- Type: text/plain, Size: 156 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 156 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: question about  rcu_bp_exit()
       [not found] ` <971830834.12745.1463596803434.JavaMail.zimbra@efficios.com>
@ 2016-05-19 19:53   ` Paul E. McKenney
  0 siblings, 0 replies; 5+ messages in thread
From: Paul E. McKenney @ 2016-05-19 19:53 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: lttng-dev

On Wed, May 18, 2016 at 06:40:03PM +0000, Mathieu Desnoyers wrote:
> ----- On May 18, 2016, at 5:44 AM, songxin <songxin_1980@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. 

I am with Mathieu on this -- not much good can be expected using things
after their cleanup.  Though I suppose that, given a sufficient use case,
there could at least in theory be an option for manual control of cleanup.

							Thanx, Paul

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: question about  rcu_bp_exit()
       [not found] <6db07fb4.c6e5.154c340296f.Coremail.songxin_1980@126.com>
@ 2016-05-18 18:40 ` Mathieu Desnoyers
       [not found] ` <971830834.12745.1463596803434.JavaMail.zimbra@efficios.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2016-05-18 18:40 UTC (permalink / raw)
  To: songxin; +Cc: lttng-dev, Paul E. McKenney


[-- Attachment #1.1: Type: text/plain, Size: 1802 bytes --]

----- On May 18, 2016, at 5:44 AM, songxin <songxin_1980@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@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers 
EfficiOS Inc. 
http://www.efficios.com 

[-- Attachment #1.2: Type: text/html, Size: 5031 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* question about  rcu_bp_exit()
@ 2016-05-18 10:04 songxin
  0 siblings, 0 replies; 5+ messages in thread
From: songxin @ 2016-05-18 10:04 UTC (permalink / raw)
  To: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 1372 bytes --]

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?


Thanks,
xin






 

[-- Attachment #1.2: Type: text/html, Size: 3102 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* question about  rcu_bp_exit()
@ 2016-05-18  9:44 songxin
  0 siblings, 0 replies; 5+ messages in thread
From: songxin @ 2016-05-18  9:44 UTC (permalink / raw)
  To: lttng-dev


[-- Attachment #1.1: Type: text/plain, Size: 1366 bytes --]

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?


Thanks,
xin


[-- Attachment #1.2: Type: text/html, Size: 2964 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-19 19:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18 10:07 question about rcu_bp_exit() songxin
     [not found] <6db07fb4.c6e5.154c340296f.Coremail.songxin_1980@126.com>
2016-05-18 18:40 ` Mathieu Desnoyers
     [not found] ` <971830834.12745.1463596803434.JavaMail.zimbra@efficios.com>
2016-05-19 19:53   ` Paul E. McKenney
  -- strict thread matches above, loose matches on Subject: below --
2016-05-18 10:04 songxin
2016-05-18  9:44 songxin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.