Project

General

Profile

Actions

Misc #20387

open

Meta-ticket for ASAN support

Added by kjtsanaktsidis (KJ Tsanaktsidis) about 1 month ago. Updated 24 days ago.


Description

I was asked to provide a bit of information about the current status of ASAN in CRuby, so I thought I'd open this meta-ticket to track all of the work I've been performing on fixing up address sanitizer support.

So far, I have fixed the following issues related to ASAN support:

The current state of things is that, by following the instructions in https://github.com/ruby/ruby/blob/master/doc/contributing/building_ruby.md, you can successfully build Ruby with ASAN enabled, however, the test suite has several failures. I'm currently working on addressing these:

The next step is to merge https://github.com/ruby/ruby/pull/10122 (https://bugs.ruby-lang.org/issues/20310) which I plan to do next week (I'm currently away on a work trip). That makes sure that VALUEs stored in ASAN fake stacks from threads other than the currently running thread get marked during GC.

After that, I need to push up patches for the remaining few issues. I mostly have these patches ready to go already; in fact, last week I got the full make check suite passing all tests with ASAN enabled!

Once that's working, I'd like to investigate how ASAN can fit into CRuby's CI matrix somewhere so that it stays working, although I have not thought too deeply about this yet.

I will provide further updates on this ticket so anybody interested can stay in the loop.


Related issues 9 (1 open8 closed)

Related to Ruby master - Bug #20001: Make Ruby work properly with ASAN enabledClosedActions
Related to Ruby master - Bug #20220: M:N threading needs to tell ASAN about stack switchesClosedkjtsanaktsidis (KJ Tsanaktsidis)Actions
Related to Ruby master - Feature #20273: Disable callcc when compiled with ASANClosedActions
Related to Ruby master - Bug #20221: ASAN: make test-basic: un-prefixed symbol leakageClosedkjtsanaktsidis (KJ Tsanaktsidis)Actions
Related to Ruby master - Feature #20274: Add RubyVM::ASAN.enabled?ClosedActions
Related to Ruby master - Bug #20243: M:N threading VM_ASSERT failure in rb_current_execution_context with clang 17 (on Linux)OpenActions
Related to Ruby master - Bug #20310: ASAN fake stacks need to be marked during GC for non-current execution contextClosedkjtsanaktsidis (KJ Tsanaktsidis)Actions
Related to Ruby master - Bug #20398: heap-buffer-overflow in numeric literal parsingClosedkjtsanaktsidis (KJ Tsanaktsidis)Actions
Related to Ruby master - Bug #20402: Double-free in TestIseqLoad#test_stressful_roundtripClosedkjtsanaktsidis (KJ Tsanaktsidis)Actions
Actions #1

Updated by kjtsanaktsidis (KJ Tsanaktsidis) about 1 month ago

  • Related to Bug #20001: Make Ruby work properly with ASAN enabled added
Actions #2

Updated by kjtsanaktsidis (KJ Tsanaktsidis) about 1 month ago

  • Related to Bug #20220: M:N threading needs to tell ASAN about stack switches added
Actions #3

Updated by kjtsanaktsidis (KJ Tsanaktsidis) about 1 month ago

  • Related to Feature #20273: Disable callcc when compiled with ASAN added
Actions #4

Updated by kjtsanaktsidis (KJ Tsanaktsidis) about 1 month ago

  • Related to Bug #20221: ASAN: make test-basic: un-prefixed symbol leakage added
Actions #5

Updated by kjtsanaktsidis (KJ Tsanaktsidis) about 1 month ago

Actions #6

Updated by kjtsanaktsidis (KJ Tsanaktsidis) about 1 month ago

  • Related to Bug #20243: M:N threading VM_ASSERT failure in rb_current_execution_context with clang 17 (on Linux) added
Actions #7

Updated by kjtsanaktsidis (KJ Tsanaktsidis) about 1 month ago

  • Related to Bug #20310: ASAN fake stacks need to be marked during GC for non-current execution context added
Actions #9

Updated by kjtsanaktsidis (KJ Tsanaktsidis) about 1 month ago

  • Related to Bug #20398: heap-buffer-overflow in numeric literal parsing added
Actions #10

Updated by kjtsanaktsidis (KJ Tsanaktsidis) 28 days ago

  • Related to Bug #20402: Double-free in TestIseqLoad#test_stressful_roundtrip added

Updated by kjtsanaktsidis (KJ Tsanaktsidis) 27 days ago

OK! Everything required to make make check pass on my machine with ASAN enabled has been merged! I opened https://github.com/ruby/ruby/pull/10412 to update the documentation to include the correct incantation.

The next things I would like to do:

  • Find some gem maintainers interested in running their tests under ASAN to see if it shakes out anything interesting
  • Could we get an ASAN build of ruby into setup-ruby? This would make it easier to use ASAN with github actions and the like.
  • How could we get ASAN plugged into ruby-ci?

I'm going to investigate these things and open tickets as appropriate once I have an idea how they should be tackled.

Updated by Eregon (Benoit Daloze) 26 days ago

kjtsanaktsidis (KJ Tsanaktsidis) wrote in #note-11:

  • Could we get an ASAN build of ruby into setup-ruby? This would make it easier to use ASAN with github actions and the like.

How about making ASAN enabled for ruby-debug builds at https://github.com/ruby/ruby-dev-builder/blob/b0bf59a17c17985d4692243d4689c273f6348fa5/.github/workflows/build.yml#L126-L130 ?

Updated by kjtsanaktsidis (KJ Tsanaktsidis) 26 days ago

How about making ASAN enabled for ruby-debug builds

That's not a bad idea (avoid adding yet more combinations!) but do you know how widely these builds are currently used and what for? ASAN will make them a heck of a lot slower so that might be undesirable for some uses.

Updated by Eregon (Benoit Daloze) 25 days ago

kjtsanaktsidis (KJ Tsanaktsidis) wrote in #note-13:

That's not a bad idea (avoid adding yet more combinations!) but do you know how widely these builds are currently used and what for? ASAN will make them a heck of a lot slower so that might be undesirable for some uses.

They are builds using -DRUBY_DEBUG=1 and optflags=-O3 -fno-inline" so I would think already quite a bit slower, so it sounds OK to me.
These ruby-debug builds are currently meant to help CRuby development, i.e., using them on your gem helps finds bugs in CRuby. I don't think there are used very often.
I think the use-case here is close enough and I am not so keen on adding a 3rd kind of CRuby dev build.

Actions #15

Updated by hsbt (Hiroshi SHIBATA) 24 days ago

  • Status changed from Open to Assigned
Actions

Also available in: Atom PDF

Like1
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0