Prevent segfaults running with SystemTap.
This commit is contained in:
parent
8157cd4820
commit
204bab4f7f
@ -0,0 +1,43 @@
|
||||
From 0ade5611df9f981005eed32b369d1e699e520221 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||
Date: Thu, 10 Feb 2022 13:26:44 +0100
|
||||
Subject: [PATCH] Don't query `RubyVM::FrozenCore` for class path.
|
||||
|
||||
The `RubyVM::FrozenCore` class path is corrupted during GC cycle and
|
||||
returns random garbage, which might result in segfault.
|
||||
|
||||
But since it is easy to detect the `RubyVM::FrozenCore`, just provide
|
||||
the class path explicitly as a workaround.
|
||||
|
||||
Other possibility would be to ignore `RubyVM::FrozenCore` simlarly as
|
||||
TracePoint API does:
|
||||
|
||||
https://github.com/ruby/ruby/blob/46f6575157d4c2f6bbd5693896e26a65037e5552/vm_trace.c#L411
|
||||
---
|
||||
vm.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/vm.c b/vm.c
|
||||
index 8ce8b279d4..3d189fa63a 100644
|
||||
--- a/vm.c
|
||||
+++ b/vm.c
|
||||
@@ -479,7 +479,15 @@ rb_dtrace_setup(rb_execution_context_t *ec, VALUE klass, ID id,
|
||||
}
|
||||
type = BUILTIN_TYPE(klass);
|
||||
if (type == T_CLASS || type == T_ICLASS || type == T_MODULE) {
|
||||
- VALUE name = rb_class_path(klass);
|
||||
+ VALUE name = Qnil;
|
||||
+ /*
|
||||
+ * Special treatment for rb_mRubyVMFrozenCore wchi is broken by GC.
|
||||
+ * https://bugs.ruby-lang.org/issues/18257
|
||||
+ */
|
||||
+ if (klass == rb_mRubyVMFrozenCore)
|
||||
+ name = rb_str_new_cstr("RubyVM::FrozenCore");
|
||||
+ else
|
||||
+ name = rb_class_path(klass);
|
||||
const char *classname, *filename;
|
||||
const char *methodname = rb_id2name(id);
|
||||
if (methodname && (filename = rb_source_location_cstr(&args->line_no)) != 0) {
|
||||
--
|
||||
2.34.1
|
||||
|
12
ruby.spec
12
ruby.spec
@ -22,7 +22,7 @@
|
||||
%endif
|
||||
|
||||
|
||||
%global release 160
|
||||
%global release 161
|
||||
%{!?release_string:%define release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}}
|
||||
|
||||
# The RubyGems library has to stay out of Ruby directory tree, since the
|
||||
@ -152,6 +152,12 @@ Patch5: ruby-1.9.3-mkmf-verbose.patch
|
||||
# https://lists.fedoraproject.org/archives/list/ruby-sig@lists.fedoraproject.org/message/LH6L6YJOYQT4Y5ZNOO4SLIPTUWZ5V45Q/
|
||||
# For now, load the ABRT hook via this simple patch:
|
||||
Patch6: ruby-2.7.0-Initialize-ABRT-hook.patch
|
||||
# Prevent segfaults running with SystemTap due to `RubyVM::FrozenCore` being
|
||||
# corrupted by GC.
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2015441
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1986206
|
||||
# https://bugs.ruby-lang.org/issues/18257
|
||||
Patch7: ruby-3.1.0-Don-t-query-RubyVM-FrozenCore-for-class-path.patch
|
||||
# Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add.
|
||||
# https://bugs.ruby-lang.org/issues/16492
|
||||
Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch
|
||||
@ -615,6 +621,7 @@ rm -rf ext/fiddle/libffi*
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch19 -p1
|
||||
|
||||
# Provide an example of usage of the tapset:
|
||||
@ -1479,6 +1486,9 @@ mv test/fiddle/test_import.rb{,.disable}
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Feb 10 2022 Vít Ondruch <vondruch@redhat.com> - 3.1.0-161
|
||||
- Prevent segfaults running with SystemTap.
|
||||
|
||||
* Wed Jan 26 2022 Vít Ondruch <vondruch@redhat.com> - 3.1.0-160
|
||||
- Upgrade to Ruby 3.1.0.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user