Skip to content

rr doesn't get along with address sanitizer #1690

Closed

Description

@jrmuizel

STR:

  • build a simple program on Ubuntu 15.10 with -fsantizer=address
  • run rr ./simple-program
    get:
    ==20722==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.

Activity

  1. rocallahan commented on May 6, 2016

    @rocallahan
    Collaborator

    I don't get this problem with clang 3.7.0 in Fedora 23. I hit a couple of other bugs, but after fixing those on master, I can now record and replay a trivial ASAN program that triggers a stack overflow report. I'll try it on Ubuntu 15.10 later.

  2. rocallahan commented on May 7, 2016

    @rocallahan
    Collaborator

    OK, I tried this on up-to-date Ubuntu 15.10 and it worked too. Maybe we need more detailed steps to reproduce your bug?

  3. rocallahan commented on May 7, 2016

    @rocallahan
    Collaborator

    Here's my test program FWIW:

    int main(void) {
      char buf[100];
      int i;
      for (i = 0; i < 101; ++i) {
        buf[i] = 1;
      }
      return 0;
    }
    
  4. abrowne2 commented on May 16, 2016

    @abrowne2

    I tried replicating this same issue with Ubuntu 14.04 with -fsanitizer=address and the above test program, and it did not produce "==20722==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.", it triggered the report as well.

  5. jrmuizel commented on May 16, 2016

    @jrmuizel
    Author

    Yep. I can't reproduce this anymore either.

  6. ehsan commented on Jun 2, 2016

    @ehsan

    This can be reproduced with the following compiler which I think is the default on Ubuntu 15.10:

    $ cc --version
    cc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
    $ cc -fsanitize=address test.cc
    $ rr ./a.out
    rr: Saving the execution of `./a.out' to trace directory `/home/ehsan/.local/share/rr/a.out-1'.
    ==12305==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
    

    test.cc is the test program above.

  7. rocallahan commented on Jun 26, 2016

    @rocallahan
    Collaborator

    OK, I think to fix this we just need to ensure libasan is added to LD_PRELOAD before librrpreload. librrpreload doesn't need to be the first library loaded (though the earlier it's loaded, the faster things will be).

    Probably the most flexible way to do this would be to add a command-line parameter to recording that allows the user to inject an arbitrary string to be inserted into the tracee LD_PRELOAD before librrpreload. This would also let you generally add things tracee LD_PRELOAD without injecting them into rr itself.

    It would be more convenient to have rr scan the libraries required by the tracee executable and automatically insert the required LD_PRELOAD so asan just works without any user intervention, but that's a bit more complicated and wouldn't solve some cases.

  8. rocallahan commented on Jun 26, 2016

    @rocallahan
    Collaborator

    Then again, if we require a special command line parameter that's not very discoverable :-(.

  9. rocallahan commented on Jun 27, 2016

    @rocallahan
    Collaborator

    OK, I implemented the fully automatic approach in dc23125.

  10. glandium commented on Dec 3, 2016

    @glandium
    Contributor

    I just hit this with rr 4.4 on Debian...

  11. rocallahan commented on Dec 5, 2016

    @rocallahan
    Collaborator

    If you run with RR_LOG=RecordSession do you see the "Prepending ... to LD_PRELOAD" message?

  12. Pamplemousse commented on Jun 30, 2021

    @Pamplemousse

    I am encountering this error with rr at version 4.5.0, and my binary compiled with clang 11.1.0 and ASAN as a shared library (-fsanitize=address -shared-libasan).

    If you run with RR_LOG=RecordSession do you see the "Prepending ... to LD_PRELOAD" message?

    No, I don't 😕

  13. rocallahan commented on Jul 1, 2021

    @rocallahan
    Collaborator

    This issue is long gone. Please follow #2892 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions