You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by GitBox <gi...@apache.org> on 2022/01/18 14:26:54 UTC

[GitHub] [celix] PengZheng opened a new issue #390: Flawed reference count implementation

PengZheng opened a new issue #390:
URL: https://github.com/apache/celix/issues/390


   The following is flawed as explained in this [LWN article](https://lwn.net/Articles/575460/):
   
   ```C
       int free = 0;
   
       mutex_lock(&s->lock);
       if (--s->refcount == 0)
           free = 1
       mutex_unlock(&s->lock);
       if (free)
   	kfree(s);
   ```
   
   Unfortunately, such flawed implementation is used in `serviceRegistration` and `serviceReference`. 
   I suggest a fix using C11  <stdatomic.h>. 
   
   What do you think? If OK, I will make a PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] PengZheng closed issue #390: Flawed reference count implementation

Posted by GitBox <gi...@apache.org>.
PengZheng closed issue #390:
URL: https://github.com/apache/celix/issues/390


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] PengZheng edited a comment on issue #390: Flawed reference count implementation

Posted by GitBox <gi...@apache.org>.
PengZheng edited a comment on issue #390:
URL: https://github.com/apache/celix/issues/390#issuecomment-1016405588


   The similar bug in glibc is finally fixed in glibc 2.23, 2016-02-18, 4 years after its initial report:
   https://sourceware.org/bugzilla/show_bug.cgi?id=13690
   
   I have no idea of other libc's situation, especially uclibc and uclibc-ng.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] PengZheng commented on issue #390: Flawed reference count implementation

Posted by GitBox <gi...@apache.org>.
PengZheng commented on issue #390:
URL: https://github.com/apache/celix/issues/390#issuecomment-1016405588


   The similar bug in glibc is finally fixed in glibc 2.23, 2016-02-18, 4 years after its initial report:
   https://sourceware.org/bugzilla/show_bug.cgi?id=13690
   
   I have no idea of other libc's situation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] pnoltes commented on issue #390: Flawed reference count implementation

Posted by GitBox <gi...@apache.org>.
pnoltes commented on issue #390:
URL: https://github.com/apache/celix/issues/390#issuecomment-1019548123


   Thanks for the ticket and for the article links. Very interesting bug, which I was not aware of. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org