Bug 206108 - lang/ruby21: fix setjmp clobbered variables (using clang 3.8.0 and optimizing for 'high' CPUs)
Summary: lang/ruby21: 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:36 UTC by Dimitry Andric
Modified: 2016-12-08 03:03 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() (6.17 KB, patch)
2016-01-10 18:36 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:36:13 UTC
Created attachment 165369 [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/ruby21 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 Kubilay Kocak freebsd_committer freebsd_triage 2016-01-10 18:38:38 UTC
Thanks Dimitry :)

Should these also go upstream?
Are later versions of ruby likely to be affected?
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2016-01-10 18:40:40 UTC
(In reply to Kubilay Kocak from comment #1)
> Should these also go upstream?

If upstream will accept them, yes please. :)


> Are later versions of ruby likely to be affected?

Yes, I submitted bug 206110 for lang/ruby22 and bug 206111 for lang/ruby23.
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2016-01-10 18:43:47 UTC
Also note that during the exp-run for bug 206074, problems are not likely to show up, since the i386 arch still defaults to the i486 CPU.  But these fixes are nice to have anyway.
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-08-01 12:09:50 UTC
A commit references this bug:

Author: julian
Date: Mon Aug  1 12:09:05 UTC 2016
New revision: 303612
URL: https://svnweb.freebsd.org/changeset/base/303612

Log:
  netgraph module for reconstructing checksums

  PR:		206108
  Submitted by:	Dmitry Vagin  daemon.hammer@ya.ru
  MFC after:	1 month

Changes:
  head/sys/modules/netgraph/checksum/
  head/sys/modules/netgraph/checksum/Makefile
  head/sys/netgraph/ng_checksum.c
  head/sys/netgraph/ng_checksum.h
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-12-02 05:36:43 UTC
A commit references this bug:

Author: julian
Date: Fri Dec  2 05:36:37 UTC 2016
New revision: 309385
URL: https://svnweb.freebsd.org/changeset/base/309385

Log:
  MFH: r303612

  netgraph module for reconstructing checksums

  PR:		206108
  Submitted by:	Dmitry Vagin  daemon.hammer@ya.ru

Changes:
_U  stable/11/
  stable/11/sys/modules/netgraph/checksum/
  stable/11/sys/netgraph/ng_checksum.c
  stable/11/sys/netgraph/ng_checksum.h
Comment 6 commit-hook freebsd_committer freebsd_triage 2016-12-02 05:38:49 UTC
A commit references this bug:

Author: julian
Date: Fri Dec  2 05:38:26 UTC 2016
New revision: 309387
URL: https://svnweb.freebsd.org/changeset/base/309387

Log:
  MFH: r303612

  netgraph module for reconstructing checksums

  PR:		206108
  Submitted by:	Dmitry Vagin  daemon.hammer@ya.ru

Changes:
_U  stable/10/
  stable/10/sys/modules/netgraph/checksum/
  stable/10/sys/netgraph/ng_checksum.c
  stable/10/sys/netgraph/ng_checksum.h
Comment 7 commit-hook freebsd_committer freebsd_triage 2016-12-08 02:58:01 UTC
A commit references this bug:

Author: swills
Date: Thu Dec  8 02:57:07 UTC 2016
New revision: 428094
URL: https://svnweb.freebsd.org/changeset/ports/428094

Log:
  lang/ruby21: fix setjmp clobbered variables

  PR:		206108
  Submitted by:	dim

Changes:
  head/Mk/bsd.ruby.mk
  head/lang/ruby21/files/patch-eval.c
  head/lang/ruby21/files/patch-eval_error.c
  head/lang/ruby21/files/patch-thread.c
  head/lang/ruby21/files/patch-vm_eval.c
  head/lang/ruby21/files/patch-vm_trace.c
Comment 8 Steve Wills freebsd_committer freebsd_triage 2016-12-08 03:03:38 UTC
Committed, please see if you can get upstream to take these and Thanks!