Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #1231455 > unrolled thread

Bug#1095018: ruby-selinux: segfault with some combinations of ruby and ruby-selinux

Started byMichael Stone <mstone@debian.org>
First post2025-02-02 19:30 +0100
Last post2025-02-06 07:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.debian.bugs.dist


Contents

  Bug#1095018: ruby-selinux: segfault with some combinations of ruby and ruby-selinux Michael Stone <mstone@debian.org> - 2025-02-02 19:30 +0100
    Bug#1095018: this would be the swig change Russell Coker <russell@coker.com.au> - 2025-02-06 07:00 +0100

#1231455 — Bug#1095018: ruby-selinux: segfault with some combinations of ruby and ruby-selinux

FromMichael Stone <mstone@debian.org>
Date2025-02-02 19:30 +0100
SubjectBug#1095018: ruby-selinux: segfault with some combinations of ruby and ruby-selinux
Message-ID<KbMTf-dSSa-5@gated-at.bofh.it>
Package: ruby-selinux
Severity: important

With ruby-selinux 3.7-3.1 and ruby 1:3.1+support3.3 I observe this behavior:

debian-testing:~$ echo "require 'selinux'" | ruby
/usr/lib/x86_64-linux-gnu/ruby/vendor_ruby/3.1.0/selinux.so: [BUG] Segmentation fault at 0x0000000000000008
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]

-- Control frame information -----------------------------------------------
c:0005 p:-11766064464904 s:0020 e:000019 TOP    [FINISH]
c:0004 p:---- s:0017 e:000016 CFUNC  :require
c:0003 p:0037 s:0012 e:000011 METHOD <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:136
c:0002 p:0005 s:0006 e:000005 EVAL   -:1 [FINISH]
c:0001 p:0000 s:0003 E:000770 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
-:1:in `<main>'
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:136:in `require'
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:136:in `require'

-- Machine register context ------------------------------------------------
 RIP: 0x00007f998e5c0391 RBP: 0x0000000000000001 RSP: 0x00007ffec2079790
 RAX: 0x0000000000000008 RBX: 0x00007f998e5ce6c0 RCX: 0x000000000000000d
 RDX: 0x0000000000000000 RDI: 0x00007f99924b90d8 RSI: 0x00007f998e5c6408
  R8: 0x0000559c00a74f60  R9: 0x0000559c00a70f50 R10: 0x337a04da6c85a688
 R11: 0x00007f99924d4e10 R12: 0x00007f998e5c6408 R13: 0x00007ffec20797f0
 R14: 0x0000000000000000 R15: 0x0000559c00973980 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(0x7f999246d97c) [0x7f999246d97c]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(0x7f99922b3994) [0x7f99922b3994]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(0x7f99923dd4af) [0x7f99923dd4af]
/lib/x86_64-linux-gnu/libc.so.6(0x7f9991f63da0) [0x7f9991f63da0]
/usr/lib/x86_64-linux-gnu/ruby/vendor_ruby/3.1.0/selinux.so(Init_selinux+0x91) [0x7f998e5c0391]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(dln_load+0x1b6) [0x7f999223bfe6]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(0x7f9992455bd1) [0x7f9992455bd1]
/lib/x86_64-linux-gnu/libruby-3.1.so.3.1(0x7f999230d8b8) [0x7f999230d8b8]
[continues]


Downgrading to 3.7-3 corrects this issue. I also don't observe the problem when
ruby-selinux 3.7-3.1 is run with ruby 1:3.3~3.2 (as in current sid). This may
be a problem which corrects itself when the newer version of ruby enters
testing (though I have not tested a partial upgrade scenario from bookworm,
which may require additional Breaks). If for some reason ruby 3.3 doesn't enter
testing prior to freeze, this will need to be addressed in ruby-selinux.

[toc] | [next] | [standalone]


#1231950 — Bug#1095018: this would be the swig change

FromRussell Coker <russell@coker.com.au>
Date2025-02-06 07:00 +0100
SubjectBug#1095018: this would be the swig change
Message-ID<Kd35D-eL0r-1@gated-at.bofh.it>
In reply to#1231455

[Multipart message — attachments visible in raw view] — view raw

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%231091131

Below is the backtrace from the Ruby test case you provided.  It shows that it 
fails in SWIG related code.  The attached patch was recently applied in 
version 3.7-3.1 to build with SWIG 4.3 and close the above bug.

The patch is needed to match the latest SWIG so reverting that patch is not an 
option - the code in question can't compile without it.

I think that the root cause of this is SWIG.

Is there anyone who has had previous experience of Ruby and SWIG who can help 
with this?

(gdb) bt
#0  rbimpl_RB_TYPE_P_fastpath (obj=8, t=RUBY_T_DATA) at /usr/include/
ruby-3.3.0/ruby/internal/value_type.h:351
#1  RB_TYPE_P (t=RUBY_T_DATA, obj=8) at /usr/include/ruby-3.3.0/ruby/internal/
value_type.h:378
#2  Check_Type (t=RUBY_T_DATA, v=8) at /usr/include/ruby-3.3.0/ruby/internal/
value_type.h:434
#3  rb_data_object_get (obj=8) at /usr/include/ruby-3.3.0/ruby/internal/core/
rdata.h:314
#4  SWIG_Ruby_GetModule (clientdata=0x0) at ./src/selinuxswig_ruby_wrap.c:1823
#5  SWIG_InitializeModule (clientdata=0x0) at ./src/selinuxswig_ruby_wrap.c:
12230
#6  Init_selinux () at ./src/selinuxswig_ruby_wrap.c:12402
#7  0x00007ffff7a3bfe6 in dln_load () from /lib/x86_64-linux-gnu/
libruby-3.1.so.3.1
#8  0x00007ffff7c55bd1 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1
#9  0x00007ffff7b0d8b8 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1
#10 0x00007ffff7b0de71 in rb_require_string () from /lib/x86_64-linux-gnu/
libruby-3.1.so.3.1
#11 0x00007ffff7c49e6c in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1
#12 0x00007ffff7c5f211 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1
#13 0x00007ffff7c54d20 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1
#14 0x00007ffff7c57f92 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1
#15 0x00007ffff7c5c686 in rb_vm_exec () from /lib/x86_64-linux-gnu/
libruby-3.1.so.3.1
#16 0x00007ffff7ab98d6 in ?? () from /lib/x86_64-linux-gnu/libruby-3.1.so.3.1
#17 0x00007ffff7abd0e7 in ruby_run_node () from /lib/x86_64-linux-gnu/
libruby-3.1.so.3.1
#18 0x000055555555510d in ?? ()
#19 0x00007ffff7833d68 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#20 0x00007ffff7833e25 in __libc_start_main () from /lib/x86_64-linux-gnu/
libc.so.6
#21 0x0000555555555151 in _start ()

-- 
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.bugs.dist


csiph-web