Bug 1551671

Summary: gc: Effectively overrides -fexceptions flag
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: gcAssignee: Rex Dieter <rdieter>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: paulo.cesar.pereira.de.andrade, praiskup, rdieter, tomm.momi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gc-7.6.4-3.fc28 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-30 12:54:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1539083    

Description Florian Weimer 2018-03-05 16:46:09 UTC
pthread_start.c contains this:

/* We want to make sure that GC_thread_exit_proc() is unconditionally   */
/* invoked, even if the client is not compiled with -fexceptions, but   */
/* the GC is.  The workaround is to put GC_inner_start_routine() in its */
/* own file (pthread_start.c), and undefine __EXCEPTIONS in the GCC     */
/* case at the top of the file.  FIXME: it's still unclear whether this */
/* will actually cause the exit handler to be invoked last when         */
/* thread_exit is called (and if -fexceptions is used).                 */
#if defined(__GNUC__) && defined(__linux__)
  /* We undefine __EXCEPTIONS to avoid using GCC __cleanup__ attribute. */
  /* The current NPTL implementation of pthread_cleanup_push uses       */
  /* __cleanup__ attribute when __EXCEPTIONS is defined (-fexceptions). */
  /* The stack unwinding and cleanup with __cleanup__ attributes work   */
  /* correctly when everything is compiled with -fexceptions, but it is */
  /* not the requirement for this library clients to use -fexceptions   */
  /* everywhere.  With __EXCEPTIONS undefined, the cleanup routines are */
  /* registered with __pthread_register_cancel thus should work anyway. */
# undef __EXCEPTIONS
#endif

Fedora is built with -fexceptions, and our tools assume that unwind tables exist, so gc should rely on this function, to benefit from pthread_cancel hardening (which the above hack bypasses).

Comment 1 Rex Dieter 2018-03-05 18:06:21 UTC
Fun.

So... fix is to just remove that section from pthread_start.c ?

Comment 2 Florian Weimer 2018-03-05 19:03:01 UTC
(In reply to Rex Dieter from comment #1)
> Fun.
> 
> So... fix is to just remove that section from pthread_start.c ?

I suppose so.  Fedora has unwind tables throughout, so it should be able to use -fexceptions even for that code.

Comment 3 Fedora Update System 2018-03-14 16:35:25 UTC
gc-7.6.4-3.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-977cb36a44

Comment 4 Fedora Update System 2018-03-15 13:30:24 UTC
gc-7.6.4-3.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-977cb36a44

Comment 5 Fedora Update System 2018-03-30 12:54:12 UTC
gc-7.6.4-3.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.