[PATCH] Cleanup signal handling in source4/smbd/process_standard.c

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] Cleanup signal handling in source4/smbd/process_standard.c

Samba - samba-technical mailing list
Hi Ralph and Uri,

I'm working towards removing the allocation
of the main server event context from the
talloc_autofree_context() which causes problems
with ultimately making the code thread-safe
and causes destructor ordering problems when
called from atexit() (as I already found).

I'm still finishing up that patchset (it
already passes make test but isn't quite as clean
as I'd like), but here is a prerequisite patch
that cleans up the freeing of the tevent_context
and signal handling on exit in the source4
process_standard.c code.

Currently the fork()'ed processes in here
inherit their SIGHUP and SIGTERM handlers
from the parent process in source4/smbd/server.c,
but these are old-style signal handlers,
installed with CatchSignal(), not new
tevent-style ones that are safe to make
non signal-safe calls. My follow up patch
fixes this of course, but it's easier to
start fixing up the child process code to
make these signal handlers tevent signal
handlers first.

Passes full make test. This won't affect
Andrew's LDAP multi-process patch and can
go in either before or after that.

Description follows :

#1: Move talloc_free(ev) call to just before exit().
#2: Add missing talloc_free(ev) before exit().
#3: Add missing return checking for tevent_add_fd calls.
#4: Add SIGHUP tevent signal handler - will override
    old handler inherited from parent (same functionality).
#5: Add SIGTERM tevent signal handler - will override
    old handler inherited from parent (same functionality).

Please review and push if happy !

Jeremy.

process_standard_cleanup (9K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] Cleanup signal handling in source4/smbd/process_standard.c

Samba - samba-technical mailing list
On Fri, Apr 07, 2017 at 10:03:09PM -0700, Jeremy Allison wrote:
> Please review and push if happy !

pushed.

-slow

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] Cleanup signal handling in source4/smbd/process_standard.c

Samba - samba-technical mailing list
In reply to this post by Samba - samba-technical mailing list
On Fri, 2017-04-07 at 22:03 -0700, Jeremy Allison via samba-technical
wrote:
> Hi Ralph and Uri,
>
> I'm working towards removing the allocation
> of the main server event context from the
> talloc_autofree_context() which causes problems
> with ultimately making the code thread-safe
> and causes destructor ordering problems when
> called from atexit() (as I already found).

Thank you so much for working on this!

Andrew Bartlett

--
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba


Loading...