Skip to content

arc::exclusive doesn't play nice with failure/unwinding. #3092

Description

@bblum
fn main() {
    do arc::exclusive(1).with |_c, one| {
        assert *one == 2;
    }
}

This segfaults and/or glibc-detected-double-free. Valgrind shows the badness shows up considerably beforehand.

rust: task failed at 'Assertion *one == 2 failed', arc3.rs:3
==13471== Thread 3:
==13471== Invalid read of size 8
==13471==    at 0x5595A1B: rust_atomic_decrement
==13471==    by 0x4E7A275: arc::rustrt::rust_atomic_decrement::_8b5c517b827e1d59::_03
==13471==    by 0x402B38: arc::dtor63::_d8dccf9b65e77125::_00
==13471==  Address 0x6ae2240 is 32 bytes inside a block of size 64 free'd
==13491==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==13471==    by 0x55AE09C: ??? (in librustrt.so)
==13471==    by 0x6AE30CF: ???
==13471==    by 0x55AE09C: ??? (in librustrt.so)

Incidentally, anybody know how to get better when-freed stack traces in valgrind?

Activity

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

    I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions