scnr / installer

Installation script for Codename SCNR.
https://ecsypno.com/pages/codename-scnr
27 stars 3 forks source link

engine.rb:98: [BUG] Illegal instruction #9

Closed r3naissance closed 2 years ago

r3naissance commented 2 years ago

When running on Ubuntu 22 (desktop or server) I'm getting the following:

└─$ ./bin/scnr -h
/opt/scnr/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine.rb:98: [BUG] Illegal instruction at 0x00007f939b59f3c0
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0026 p:---- s:0163 e:000162 CFUNC  :initialize
c:0025 p:---- s:0160 e:000159 CFUNC  :new
c:0024 p:0149 s:0153 e:000152 METHOD /opt/scnr/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine.rb:98
c:0023 p:0215 s:0147 e:000146 TOP    /opt/scnr/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine.rb:161 [FINISH]
c:0022 p:---- s:0144 e:000143 CFUNC  :RGLoader_load
c:0021 p:0193 s:0139 e:000138 TOP    /opt/scnr/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine.rb:2 [FINISH]
c:0020 p:---- s:0132 e:000131 CFUNC  :require
c:0019 p:0195 s:0127 e:000126 METHOD /opt/scnr/.system/usr/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85
c:0018 p:0005 s:0110 e:000109 TOP    /opt/scnr/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine/api.rb:1 [FINISH]
c:0017 p:---- s:0107 e:000106 CFUNC  :RGLoader_load
c:0016 p:0193 s:0102 e:000101 TOP    /opt/scnr/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine/api.rb:2 [FINISH]
c:0015 p:---- s:0095 e:000094 CFUNC  :require
c:0014 p:0195 s:0090 e:000089 METHOD /opt/scnr/.system/usr/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85
c:0013 p:0011 s:0073 e:000072 TOP    /opt/scnr/.system/gems/gems/scnr-application-0.0.1/lib/scnr/application.rb:2 [FINISH]
c:0012 p:---- s:0070 e:000069 CFUNC  :RGLoader_load
c:0011 p:0193 s:0065 e:000064 TOP    /opt/scnr/.system/gems/gems/scnr-application-0.0.1/lib/scnr/application.rb:2 [FINISH]
c:0010 p:---- s:0058 e:000057 CFUNC  :require
c:0009 p:0195 s:0053 e:000052 METHOD /opt/scnr/.system/usr/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85
c:0008 p:0011 s:0036 e:000035 TOP    /opt/scnr/.system/gems/gems/scnr-ui-cli-1.0dev/lib/scnr/ui/cli.rb:12 [FINISH]
c:0007 p:---- s:0033 e:000032 CFUNC  :RGLoader_load
c:0006 p:0193 s:0028 e:000027 TOP    /opt/scnr/.system/gems/gems/scnr-ui-cli-1.0dev/lib/scnr/ui/cli.rb:2 [FINISH]
c:0005 p:---- s:0021 e:000020 CFUNC  :require_relative
c:0004 p:0005 s:0016 e:000015 TOP    /opt/scnr/.system/gems/gems/scnr-ui-cli-1.0dev/bin/scnr:10 [FINISH]
c:0003 p:---- s:0013 e:000012 CFUNC  :load
c:0002 p:0124 s:0008 E:001920 EVAL   /opt/scnr/bin/../.system/gems/bin/scnr:25 [FINISH]
c:0001 p:0000 s:0003 E:001230 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
<SNIP>

Any thoughts on resolution. I checked rgloader and found that there is an update so I updated the libraries in .system/rgloader but same errors (didn't think it would magically start working but thought since engine.rb is referencing RubyEncode it might be a place to start).

Zapotek commented 2 years ago

Hello,

What is your GLIBC version? SCNR requires >= 2.31.

You can find out with: ldd --version

Cheers

r3naissance commented 2 years ago

GLIBC == ldd (Ubuntu GLIBC 2.35-0ubuntu3) 2.35

I was thinking that it's the Ruby version I'm using (default on Ubuntu 22 is Ruby3). So to install Ruby 2.7 I had to first compile and install openssl 1.1.1 (openssl3 is default). Now I can compile, install, and set Ruby 2.7.5 as my global Ruby env. However, I'm still getting the same error even after a clean install if scnr using:

ruby-2.7.5 || ruby-2.7.6 || ruby-3.1.2

Zapotek commented 2 years ago

Ruby is bundled so you don't need to install it.

Is this a vanilla install of Ubuntu?

r3naissance commented 2 years ago

Oh that's right, apologies. Yes a fresh install of either Ubuntu 22 server or desktop.

Zapotek commented 2 years ago

Thanks, I'll try to reproduce in a VM.

Zapotek commented 2 years ago

Tried with both desktop and server versions and couldn't reproduce. Silly question, you're running 64bit right?

r3naissance commented 2 years ago
user@ubuntu22:~$ uname -a
Linux ubuntu22 5.15.0-30-generic #31-Ubuntu SMP Thu May 5 10:00:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
user@ubuntu22:~$ ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3) 2.35
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
user@ubuntu22:~$ bash -c "$(curl -sSL https://raw.githubusercontent.com/scnr/installer/main/install.sh)"

                      SCNR installer
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         by Tasos Laskos <tasos.laskos@ecsypno.com>
-------------------------------------------------------------------------

(1/2) Google Chrome
   * Downloading...done.
   * Installing...[sudo] password for user:
done.

(2/2) SCNR
   * Downloading...done.
   * Installing...done.

SCNR installed at:   /home/user/scnr-1.0dev-1.0dev-1.0dev
Installation log at: /home/user/scnr.install.log
user@ubuntu22:~$ /home/user/scnr-1.0dev-1.0dev-1.0dev/bin/scnr -h
/home/user/scnr-1.0dev-1.0dev-1.0dev/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine.rb:98: [BUG] Illegal instruction at 0x00007f3f9158a3c0
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0026 p:---- s:0163 e:000162 CFUNC  :initialize
c:0025 p:---- s:0160 e:000159 CFUNC  :new
c:0024 p:0149 s:0153 e:000152 METHOD /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine.rb:98
c:0023 p:0215 s:0147 e:000146 TOP    /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine.rb:161 [FINISH]
c:0022 p:---- s:0144 e:000143 CFUNC  :RGLoader_load
c:0021 p:0193 s:0139 e:000138 TOP    /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine.rb:2 [FINISH]
c:0020 p:---- s:0132 e:000131 CFUNC  :require
c:0019 p:0195 s:0127 e:000126 METHOD /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/usr/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85
c:0018 p:0005 s:0110 e:000109 TOP    /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine/api.rb:1 [FINISH]
c:0017 p:---- s:0107 e:000106 CFUNC  :RGLoader_load
c:0016 p:0193 s:0102 e:000101 TOP    /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/gems/gems/scnr-engine-1.0dev/lib/scnr/engine/api.rb:2 [FINISH]
c:0015 p:---- s:0095 e:000094 CFUNC  :require
c:0014 p:0195 s:0090 e:000089 METHOD /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/usr/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85
c:0013 p:0011 s:0073 e:000072 TOP    /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/gems/gems/scnr-application-0.0.1/lib/scnr/application.rb:2 [FINISH]
c:0012 p:---- s:0070 e:000069 CFUNC  :RGLoader_load
c:0011 p:0193 s:0065 e:000064 TOP    /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/gems/gems/scnr-application-0.0.1/lib/scnr/application.rb:2 [FINISH]
c:0010 p:---- s:0058 e:000057 CFUNC  :require
c:0009 p:0195 s:0053 e:000052 METHOD /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/usr/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85
c:0008 p:0011 s:0036 e:000035 TOP    /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/gems/gems/scnr-ui-cli-1.0dev/lib/scnr/ui/cli.rb:12 [FINISH]
c:0007 p:---- s:0033 e:000032 CFUNC  :RGLoader_load
c:0006 p:0193 s:0028 e:000027 TOP    /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/gems/gems/scnr-ui-cli-1.0dev/lib/scnr/ui/cli.rb:2 [FINISH]
c:0005 p:---- s:0021 e:000020 CFUNC  :require_relative
c:0004 p:0005 s:0016 e:000015 TOP    /home/user/scnr-1.0dev-1.0dev-1.0dev/.system/gems/gems/scnr-ui-cli-1.0dev/bin/scnr:10 [FINISH]
c:0003 p:---- s:0013 e:000012 CFUNC  :load
c:0002 p:0124 s:0008 E:001f60 EVAL   /home/user/scnr-1.0dev-1.0dev-1.0dev/bin/../.system/gems/bin/scnr:25 [FINISH]
c:0001 p:0000 s:0003 E:000580 (none) [FINISH]
Zapotek commented 2 years ago

This happens when loading SCNR's extension from what I see, although I see no reason why it should segfault like that and it's working fine for me with fresh installs of Ubuntu 22.04.

I'm at a loss to be honest, at least at the moment. I'll keep thinking.

Thanks for the feedback.

r3naissance commented 2 years ago

I think this has to do with my hypervisor actually. I use XCP-ng and the latest Arachni (3-17-2022) and the latest SCNR version error in the same way. I installed Ubuntu 22 in VirtualBox and both tools work as expected. So something must be going on with my underlying infrastructure as every other dependency is the same. What's strange is the older release of Arachni that used PhantomJS worked without issue on this stack. Feel free to mark as not a bug. I appreciate your time!

Zapotek commented 2 years ago

Ah I see, no worries.