• Witold Krecicki's avatar
    Fix possible race in socket destruction. · fd8788eb
    Witold Krecicki authored
    When two threads unreferenced handles coming from one socket while
    the socket was being destructed we could get a use-after-free:
    Having handle H1 coming from socket S1, H2 coming from socket S2,
    S0 being a parent socket to S1 and S2:
    
    Thread A                             Thread B
    Unref handle H1                      Unref handle H2
    Remove H1 from S1 active handles     Remove H2 from S2 active handles
    nmsocket_maybe_destroy(S1)           nmsocket_maybe_destroy(S2)
    nmsocket_maybe_destroy(S0)           nmsocket_maybe_destroy(S0)
    LOCK(S0->lock)
    Go through all children, figure
    out that we have no more active
    handles:
    sum of S0->children[i]->ah == 0
    UNLOCK(S0->lock)
    destroy(S0)
                                         LOCK(S0->lock)
                                          - but S0 is already gone
    fd8788eb
Name
Last commit
Last update
.gitlab/issue_templates Loading commit data...
bin Loading commit data...
cocci Loading commit data...
conftools/perllib/dnsconf Loading commit data...
contrib Loading commit data...
doc Loading commit data...
docutil Loading commit data...
fuzz Loading commit data...
lib Loading commit data...
m4 Loading commit data...
make Loading commit data...
unit Loading commit data...
util Loading commit data...
win32utils Loading commit data...
.dir-locals.el Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
.uncrustify.cfg Loading commit data...
CHANGES Loading commit data...
CODE_OF_CONDUCT Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYRIGHT Loading commit data...
HISTORY Loading commit data...
HISTORY.md Loading commit data...
Kyuafile Loading commit data...
LICENSE Loading commit data...
Makefile.in Loading commit data...
OPTIONS Loading commit data...
OPTIONS.md Loading commit data...
PLATFORMS Loading commit data...
PLATFORMS.md Loading commit data...
README Loading commit data...
README.md Loading commit data...
aclocal.m4 Loading commit data...
autogen.sh Loading commit data...
bind.keys Loading commit data...
bind.keys.h Loading commit data...
config.guess Loading commit data...
config.h.in Loading commit data...
config.h.win32 Loading commit data...
config.sub Loading commit data...
config.threads.in Loading commit data...
configure Loading commit data...
configure.ac Loading commit data...
install-sh Loading commit data...
ltmain.sh Loading commit data...
mkinstalldirs Loading commit data...
version Loading commit data...