On winbind shutdown prior to the removal of gencache_stabilize we could crash due to races

Jeremy Allison jra at samba.org
Mon Mar 11 19:32:31 UTC 2019


On Mon, Mar 11, 2019 at 12:30:47PM -0700, Richard Sharpe wrote:
> 
> OK, now I understand the bug fully. I was confused for a while because
> I have been doing a lot of work with pthreads, but this is not a
> pthreads situation, but a separate process issue.
> 
> This code is still in v4-9-stable:
> 
> static void terminate(bool is_parent)
> {
>         if (is_parent) {
>                 /* When parent goes away we should
>                  * remove the socket file. Not so
>                  * when children terminate.
>                  */
>                 char *path = NULL;
> 
>                 if (asprintf(&path, "%s/%s",
>                         lp_winbindd_socket_directory(),
> WINBINDD_SOCKET_NAME) > 0) {
>                         unlink(path);
>                         SAFE_FREE(path);
>                 }
>         }
> 
>         idmap_close();
> 
>         gencache_stabilize();
> 
>         netlogon_creds_cli_close_global_db();
> 
> If the parent exists before the children have finished their
> gencache_stabilize scans, they will crash, because the mmap'd region
> goes away.
> 
> I will file a ticket.

Great, thanks ! Once you've got a fix we can
ensure it's back-ported to all supported versions.

Cheers,

	Jeremy.



More information about the samba-technical mailing list