[前][次][番号順一覧][スレッド一覧]

ruby-changes:65768

From: usa <ko1@a...>
Date: Mon, 5 Apr 2021 08:32:00 +0900 (JST)
Subject: [ruby-changes:65768] c08edc4eef (ruby_2_6): merge revision(s) 8b0dc77a621ded75f72486c33f55404ce73f00d7: [Backport #17275]

https://git.ruby-lang.org/ruby.git/commit/?id=c08edc4eef

From c08edc4eeffa3590b6853b882ce211bb6bca5f8d Mon Sep 17 00:00:00 2001
From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Sun, 4 Apr 2021 23:31:49 +0000
Subject: merge revision(s) 8b0dc77a621ded75f72486c33f55404ce73f00d7: [Backport
 #17275]

	configure.ac: Bump the size of sigaltstack

	The RubyVM uses C macro defines to feature detect whether
	`backtrace(2)` support is available, and if so it includes C level backtraces
	when the RubyVM itself crashes.

	But on my machine, C level backtraces from `vm_dump.c` didn't work when
	using a version of Ruby buillt on the machine, but worked fine when using a
	version of Ruby built on another machine and copied to my machine.

	The default autoconf test for backtraces uses a sigaltstack size that is
	too small, so the SIGSEGV signal handler itself causes a SIGSEGV).
	I noticed that signal.c uses a larger sigaltstack size:

	https://github.com/ruby/ruby/blob/v2_6_5/signal.c#L568

	The specific variables it looks at:

	- `HAVE_BACKTRACE`

	  this is a macro defined by autoconf because there is a line in the
	  configure script like `AC_CHECK_FUNCS(backtrace)` (see the autoconf
	  docs for more).

	- `BROKEN_BACKTRACE`

	  this comes from a custom program that Ruby's configure script runs to
	  attempt to figure out whether actually using backtrace(2) in a real
	  program works. You can see the autoconf program here.

	  <https://github.com/ruby/ruby/blob/v2_6_5/configure.ac#L2817-L2863>

	It uses sigaltstack and SA_ONSTACK to create a seperate stack for
	handling signals.

	The problem was: SIGSTKSZ (which comes from a system header!) was not
	suggesting a large enough stack size. When checking on an Ubuntu 16.04
	box, we found that SIGSTKSZ was 8192 and MINSIGSTKSZ was 2048.
	---
	 configure.ac | 4 ++--
	 1 file changed, 2 insertions(+), 2 deletions(-)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
 configure.ac | 4 ++--
 version.h    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index f849a65..3a71fa0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2853,12 +2853,12 @@ main(void) https://github.com/ruby/ruby/blob/trunk/configure.ac#L2853
     stack_t ss;
     struct sigaction sa;
 
-    ss.ss_sp = malloc(SIGSTKSZ);
+    ss.ss_sp = malloc(16*1024);
     if (ss.ss_sp == NULL) {
 	fprintf(stderr, "cannot allocate memory for sigaltstack\n");
 	return EXIT_FAILURE;
     }
-    ss.ss_size = SIGSTKSZ;
+    ss.ss_size = 16*1024;
     ss.ss_flags = 0;
     if (sigaltstack(&ss, NULL) == -1) {
 	fprintf(stderr, "sigaltstack failed\n");
diff --git a/version.h b/version.h
index 5891dab..78d1fa8 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1
 #define RUBY_VERSION "2.6.7"
 #define RUBY_RELEASE_DATE "2021-04-05"
-#define RUBY_PATCHLEVEL 183
+#define RUBY_PATCHLEVEL 184
 
 #define RUBY_RELEASE_YEAR 2021
 #define RUBY_RELEASE_MONTH 4
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]