Bug 806413

Summary: Please make Xorg server to exit with correct exitcode on SEGV (patch included)
Product: [Fedora] Fedora Reporter: Denys Vlasenko <dvlasenk>
Component: xorg-x11-serverAssignee: X/OpenGL Maintenance List <xgl-maint>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: peter.hutterer, xgl-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-08 05:07:29 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 Flags
Proposed patch none

Description Denys Vlasenko 2012-03-23 16:37:24 UTC
Created attachment 572331 [details]
Proposed patch

Currently when Xorg server receives fatal signal, it generates some diagnostics, performs some cleanup, and exits with exit code 1.

Thus, it will not exit with correct exit code. If parent process will check for it, it will see WIFEXITED = true, not WIFSIGNALED = true.

This seems to be not too difficult to rectify: instead of exiting, we cal reset signal handler to SIG_DFL, and resend the signals to ourself again.

Please see attached patch.

While at it, I also corrected a typo in error message: s/Recieved/Received/

Comment 1 Peter Hutterer 2012-10-08 05:07:29 UTC
Denys, this is a good idea. Unfortunately, your patch does not compile (undefined reference FatalSignal) and it doesn't have any effect.
The call to raise() is after OsAbort() which calls abort(3), so your code is never hit. Also, in the case of abort, the exit code is always 134 (128 + SIGABRT). Finally, the exit code listed in the log has an actual meaning:

    EXIT_NO_ERROR = 0,
    EXIT_ERR_ABORT = 1,
    EXIT_ERR_CONFIGURE = 2,
    EXIT_ERR_DRIVERS = 3


I'll close this bug here, this is stuff that we need to get upstream first. Please submit the patch to the xorg-devel list (against 1.13 or git master to make it easier for maintainers).

fwiw, I'll get the typo patch as standalone into the upstream server, so consider that one done.