Bug 67232
| Summary: | hotplug runs with SIGCHLD ignored: breaks initlog | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | diego.santacruz | ||||
| Component: | hotplug | Assignee: | Bill Nottingham <notting> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | Brock Organ <borgan> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | 7.2 | CC: | rvokal | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | i686 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2005-02-04 20:48:50 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
diego.santacruz
2002-06-21 12:09:10 UTC
Created attachment 62024 [details]
A wrapper that re-enables SIGCHLD and stdout and stderr.
I use the previously attached hotplug wrapper by adding
if [ -x /usr/local/sbin/hotplugwrap ]; then
AGENT="/usr/local/sbin/hotplugwrap $AGENT"
fi
just above the exec $AGENT "$@" call towards the end of the /sbin/hotplug script.
This has solved the problem I previously reported as bug #64603.
Arjan: should the kernel not start hotplug with SIGCHLD ignoredor should we add a wrapper? Any news on this? I installed RedHat 8.0 and the problem is still there. As per signal(7) the default action for SIGCHLD is "ignore" (i.e. SIG_DFL would ignore the signal). So it would seem to be equivalent to set SIGCHLD to SIG_IGN, but that is not the case. AFAIK, if SIGCHLD is set to SIG_IGN it is not possible to use wait() and waitpid(), which is the root of the problem here, since the child is reapead as soon as it exits. I checked the kernel-2.4.18-10 source. All the users of hotplug call the hotplug helper through call_usermodehelper() of kmod.c (except S390, in misc/chandev.c). After setting a new kernel thread call_usermodehelper() calls exec_usermodehelper() to exec the user mode program. exec_usermodehelper() will reset the signal handlers with flush_signal_handlers(). That function will set all signal handlers to SIG_DFL, *except* those which are already at SIG_IGN. So apparently, whatever task is calling call_usermodehelper() has SIGCHLD set to SIG_IGN (which would seem logical, since it does not want to get zombie children). However, the user mode helper should be able to use wait() and waitpid(), so it should be started with SIGCHLD set to SIG_DFL. I have no idea about kernel development, but I would say that exec_userhelper() should set SIGCHLD to SIG_DFL just after the call to flush_signal_handlers(). Using a wrapper is just a temporary solution, bound to break in the future. Any program that plans to use SIGCLD must be sure to set the signal masks properly. If initlog gets it wrong then initlog is broken - and indeed in some cases may break in scripts or from cron. hotplug setting SIGCLD might paper over bugs and be a good thing short term but neither it nor the kernel are actually wrong in any way OK, I agree, I updated bug #64603. But still, wouldn't it be more convenient to set SIGCHLD to SIG_DFL for the user processes started by the kernel? Just my 2 cents. Closing out bugs on older, no longer supported, releases. Apologies for any lack of response. Please reopen if problems persist on more current releases. initlog is no longer shipped in development, FWIW. |