ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:101927] [Ruby master Bug#14480] miniruby crashing when compiled with -O2 or -O1 on aarch64
       [not found] <redmine.issue-14480.20180216085455.703@ruby-lang.org>
@ 2021-01-05  4:39 ` mame
  2021-02-23 10:35 ` [ruby-core:102576] " xtkoba+ruby
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: mame @ 2021-01-05  4:39 UTC (permalink / raw)
  To: ruby-core

Issue #14480 has been updated by mame (Yusuke Endoh).


Looks like the status of `__builtin_setjmp` is very complicated:

[The documentation of GCC](https://gcc.gnu.org/onlinedocs/gcc/Nonlocal-Gotos.html) says:

> GCC provides the built-in functions __builtin_setjmp and __builtin_longjmp which are similar to, but not interchangeable with, the C library functions setjmp and longjmp. The built-in versions are used internally by GCC’s libraries to implement exception handling on some targets. You should use the standard C library functions declared in <setjmp.h> in user code instead of the builtins.

> An important caveat is that GCC arranges to save and restore only those registers known to the specific architecture variant being compiled for. This can make __builtin_setjmp and __builtin_longjmp more efficient than their library counterparts in some cases, but it can also cause incorrect and mysterious behavior when mixing with code that uses the full register set.

So, in general, it looks good to avoid using `__builtin_setjmp`/`__builtin_longjmp` in Ruby.

It was introduced for a performance reason on Mac OS X in 2008.

http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-core/16023?15980-16545+split-mode-vertical

I'm unsure if this performance improvement on macOS is still significant. Anyone is interested in measuring the peformance?

Actually, using `__builtin_setjmp` has been very troublesome. It is explicitly disabled on some architectures/conditions:

* AIX: d612c44dad8a5d4c373b0c4bc08a99e3dc06498e
* ppc64* LInux: 67fcbf9328614379fee28bed83ae6749ce7a3dda
* when -fcf-protection is used: #15307
* GCC 4 or before: #10272

And looks like we need to disable it on Android too. #17511

But interestingly, it is explicitly enabled on mingw64 because it was apparently needed to fix an issue: #15348.

----------------------------------------
Bug #14480: miniruby crashing when compiled with -O2 or -O1 on aarch64
https://bugs.ruby-lang.org/issues/14480#change-89774

* Author: vo.x (Vit Ondruch)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [aarch64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Recently, it is not possible to build Ruby 2.5.0 on aarch64 on Fedora Rawhide, because miniruby fails during build:

~~~
... snip ...

./miniruby -I./lib -I. -I.ext/common  -n \
-e 'BEGIN{version=ARGV.shift;mis=ARGV.dup}' \
-e 'END{abort "UNICODE version mismatch: #{mis}" unless mis.empty?}' \
-e '(mis.delete(ARGF.path); ARGF.close) if /ONIG_UNICODE_VERSION_STRING +"#{Regexp.quote(version)}"/o' \
10.0.0 ./enc/unicode/10.0.0/casefold.h ./enc/unicode/10.0.0/name2ctype.h 
generating encdb.h
./miniruby -I./lib -I. -I.ext/common  ./tool/generic_erb.rb -c -o encdb.h ./template/encdb.h.tmpl ./enc enc
generating prelude.c
./miniruby -I./lib -I. -I.ext/common  ./tool/generic_erb.rb -I. -c -o prelude.c \
	./template/prelude.c.tmpl ./prelude.rb ./gem_prelude.rb ./abrt_prelude.rb
*** stack smashing detected ***: <unknown> terminated
encdb.h updated

... snip ...
~~~

This might by Ruby or gcc issue. Not sure yet. However, there is already lengthy analysis available in Fedora's Bugzilla [1]. Would be anybody able to help to resolve this issue?


[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1545239

---Files--------------------------------
Dockerfile (573 Bytes)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:102576] [Ruby master Bug#14480] miniruby crashing when compiled with -O2 or -O1 on aarch64
       [not found] <redmine.issue-14480.20180216085455.703@ruby-lang.org>
  2021-01-05  4:39 ` [ruby-core:101927] [Ruby master Bug#14480] miniruby crashing when compiled with -O2 or -O1 on aarch64 mame
@ 2021-02-23 10:35 ` xtkoba+ruby
  2023-08-23 23:23 ` [ruby-core:114473] " jeremyevans0 (Jeremy Evans) via ruby-core
  2023-09-22  9:49 ` [ruby-core:114876] " vo.x (Vit Ondruch) via ruby-core
  3 siblings, 0 replies; 4+ messages in thread
From: xtkoba+ruby @ 2021-02-23 10:35 UTC (permalink / raw)
  To: ruby-core

Issue #14480 has been updated by xtkoba (Tee KOBAYASHI).


The main issue might be resolved by the following commit to GCC:
https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=25403c416e5f12d681d1fc45a8789d19ab40297f
(see also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84521#c29)

IMHO, the use of `__builtin_{set,long}jmp` should be opt-in. They are probably safe to use in recent GCC versions, but may not in Clang/LLVM (or other compilers than GCC).

----------------------------------------
Bug #14480: miniruby crashing when compiled with -O2 or -O1 on aarch64
https://bugs.ruby-lang.org/issues/14480#change-90560

* Author: vo.x (Vit Ondruch)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [aarch64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Recently, it is not possible to build Ruby 2.5.0 on aarch64 on Fedora Rawhide, because miniruby fails during build:

~~~
... snip ...

./miniruby -I./lib -I. -I.ext/common  -n \
-e 'BEGIN{version=ARGV.shift;mis=ARGV.dup}' \
-e 'END{abort "UNICODE version mismatch: #{mis}" unless mis.empty?}' \
-e '(mis.delete(ARGF.path); ARGF.close) if /ONIG_UNICODE_VERSION_STRING +"#{Regexp.quote(version)}"/o' \
10.0.0 ./enc/unicode/10.0.0/casefold.h ./enc/unicode/10.0.0/name2ctype.h 
generating encdb.h
./miniruby -I./lib -I. -I.ext/common  ./tool/generic_erb.rb -c -o encdb.h ./template/encdb.h.tmpl ./enc enc
generating prelude.c
./miniruby -I./lib -I. -I.ext/common  ./tool/generic_erb.rb -I. -c -o prelude.c \
	./template/prelude.c.tmpl ./prelude.rb ./gem_prelude.rb ./abrt_prelude.rb
*** stack smashing detected ***: <unknown> terminated
encdb.h updated

... snip ...
~~~

This might by Ruby or gcc issue. Not sure yet. However, there is already lengthy analysis available in Fedora's Bugzilla [1]. Would be anybody able to help to resolve this issue?


[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1545239

---Files--------------------------------
Dockerfile (573 Bytes)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:114473] [Ruby master Bug#14480] miniruby crashing when compiled with -O2 or -O1 on aarch64
       [not found] <redmine.issue-14480.20180216085455.703@ruby-lang.org>
  2021-01-05  4:39 ` [ruby-core:101927] [Ruby master Bug#14480] miniruby crashing when compiled with -O2 or -O1 on aarch64 mame
  2021-02-23 10:35 ` [ruby-core:102576] " xtkoba+ruby
@ 2023-08-23 23:23 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2023-09-22  9:49 ` [ruby-core:114876] " vo.x (Vit Ondruch) via ruby-core
  3 siblings, 0 replies; 4+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2023-08-23 23:23 UTC (permalink / raw)
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

Issue #14480 has been updated by jeremyevans0 (Jeremy Evans).


I submitted a pull request to disable `__builtin_setjmp` for Linux aarch64: https://github.com/ruby/ruby/pull/8272

----------------------------------------
Bug #14480: miniruby crashing when compiled with -O2 or -O1 on aarch64
https://bugs.ruby-lang.org/issues/14480#change-104256

* Author: vo.x (Vit Ondruch)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [aarch64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Recently, it is not possible to build Ruby 2.5.0 on aarch64 on Fedora Rawhide, because miniruby fails during build:

~~~
... snip ...

./miniruby -I./lib -I. -I.ext/common  -n \
-e 'BEGIN{version=ARGV.shift;mis=ARGV.dup}' \
-e 'END{abort "UNICODE version mismatch: #{mis}" unless mis.empty?}' \
-e '(mis.delete(ARGF.path); ARGF.close) if /ONIG_UNICODE_VERSION_STRING +"#{Regexp.quote(version)}"/o' \
10.0.0 ./enc/unicode/10.0.0/casefold.h ./enc/unicode/10.0.0/name2ctype.h 
generating encdb.h
./miniruby -I./lib -I. -I.ext/common  ./tool/generic_erb.rb -c -o encdb.h ./template/encdb.h.tmpl ./enc enc
generating prelude.c
./miniruby -I./lib -I. -I.ext/common  ./tool/generic_erb.rb -I. -c -o prelude.c \
	./template/prelude.c.tmpl ./prelude.rb ./gem_prelude.rb ./abrt_prelude.rb
*** stack smashing detected ***: <unknown> terminated
encdb.h updated

... snip ...
~~~

This might by Ruby or gcc issue. Not sure yet. However, there is already lengthy analysis available in Fedora's Bugzilla [1]. Would be anybody able to help to resolve this issue?


[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1545239

---Files--------------------------------
Dockerfile (573 Bytes)


-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:114876] [Ruby master Bug#14480] miniruby crashing when compiled with -O2 or -O1 on aarch64
       [not found] <redmine.issue-14480.20180216085455.703@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2023-08-23 23:23 ` [ruby-core:114473] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2023-09-22  9:49 ` vo.x (Vit Ondruch) via ruby-core
  3 siblings, 0 replies; 4+ messages in thread
From: vo.x (Vit Ondruch) via ruby-core @ 2023-09-22  9:49 UTC (permalink / raw)
  To: ruby-core; +Cc: vo.x (Vit Ondruch)

Issue #14480 has been updated by vo.x (Vit Ondruch).


Please note that on Fedora this was not issue for past ~5 years. This has beend workarounded on GCC side:

https://bugzilla.redhat.com/show_bug.cgi?id=1545239#c42

And it seems that the GCC folks position is that this should behave consistently everywhere. So I am not sure why the PR above extends the special casing of some platforms instead of removing it.

----------------------------------------
Bug #14480: miniruby crashing when compiled with -O2 or -O1 on aarch64
https://bugs.ruby-lang.org/issues/14480#change-104727

* Author: vo.x (Vit Ondruch)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [aarch64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Recently, it is not possible to build Ruby 2.5.0 on aarch64 on Fedora Rawhide, because miniruby fails during build:

~~~
... snip ...

./miniruby -I./lib -I. -I.ext/common  -n \
-e 'BEGIN{version=ARGV.shift;mis=ARGV.dup}' \
-e 'END{abort "UNICODE version mismatch: #{mis}" unless mis.empty?}' \
-e '(mis.delete(ARGF.path); ARGF.close) if /ONIG_UNICODE_VERSION_STRING +"#{Regexp.quote(version)}"/o' \
10.0.0 ./enc/unicode/10.0.0/casefold.h ./enc/unicode/10.0.0/name2ctype.h 
generating encdb.h
./miniruby -I./lib -I. -I.ext/common  ./tool/generic_erb.rb -c -o encdb.h ./template/encdb.h.tmpl ./enc enc
generating prelude.c
./miniruby -I./lib -I. -I.ext/common  ./tool/generic_erb.rb -I. -c -o prelude.c \
	./template/prelude.c.tmpl ./prelude.rb ./gem_prelude.rb ./abrt_prelude.rb
*** stack smashing detected ***: <unknown> terminated
encdb.h updated

... snip ...
~~~

This might by Ruby or gcc issue. Not sure yet. However, there is already lengthy analysis available in Fedora's Bugzilla [1]. Would be anybody able to help to resolve this issue?


[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1545239

---Files--------------------------------
Dockerfile (573 Bytes)


-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-22  9:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-14480.20180216085455.703@ruby-lang.org>
2021-01-05  4:39 ` [ruby-core:101927] [Ruby master Bug#14480] miniruby crashing when compiled with -O2 or -O1 on aarch64 mame
2021-02-23 10:35 ` [ruby-core:102576] " xtkoba+ruby
2023-08-23 23:23 ` [ruby-core:114473] " jeremyevans0 (Jeremy Evans) via ruby-core
2023-09-22  9:49 ` [ruby-core:114876] " vo.x (Vit Ondruch) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).