Bug 206111 - lang/ruby23: fix setjmp clobbered variables (using clang 3.8.0 and optimizing for 'high' CPUs)
Summary: lang/ruby23: fix setjmp clobbered variables (using clang 3.8.0 and optimizing...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ruby (Nobody)
URL:
Keywords: needs-qa, patch
Depends on:
Blocks:
 
Reported: 2016-01-10 18:38 UTC by Dimitry Andric
Modified: 2016-12-07 22:04 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (ruby)
koobs: merge-quarterly?


Attachments
Mark several variables volatile so they won't have undefined state after setjmp() (5.80 KB, patch)
2016-01-10 18:38 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2016-01-10 18:38:25 UTC
Created attachment 165371 [details]
Mark several variables volatile so they won't have undefined state after setjmp()

During my preparations for bug 206074 (exp-run for clang 3.8.0), I noticed that lang/ruby23 would sometimes crash during the build.  Specifically, on i386, with CPUTYPE=ivybridge, you would get segfaults in miniruby.

It turns out these are because there are several places in ruby where setjmp() is used, and where not all variables accessed after setjmp() are marked volatile.  This can cause them to have undefined state.

Fix this by marking several variables in different functions volatile.

These patches were obtained from NetBSD pkgsrc, thanks to Jörg Sonnenberger for the hint.
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-12-07 16:09:45 UTC
A commit references this bug:

Author: swills
Date: Wed Dec  7 16:08:55 UTC 2016
New revision: 428067
URL: https://svnweb.freebsd.org/changeset/ports/428067

Log:
  lang/ruby23: fix setjmp clobbered variables

  PR:		206111
  Submitted by:	dim

Changes:
  head/Mk/bsd.ruby.mk
  head/lang/ruby23/files/patch-eval.c
  head/lang/ruby23/files/patch-eval_error.c
  head/lang/ruby23/files/patch-thread.c
  head/lang/ruby23/files/patch-vm_eval.c
  head/lang/ruby23/files/patch-vm_trace.c
Comment 2 Steve Wills freebsd_committer freebsd_triage 2016-12-07 16:11:59 UTC
Committed, please submit upstream too. Thanks!
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2016-12-07 22:04:31 UTC
(In reply to Steve Wills from comment #2)
> Committed, please submit upstream too. Thanks!

https://bugs.ruby-lang.org/issues/13014 (also refers back to this bug, and another earlier and related ruby bug)