mstange / framehop

Stack unwinding library in Rust
Apache License 2.0
82 stars 11 forks source link

Don't `take` values out of ExplicitModuleSectionInfo #32

Closed Amjad50 closed 8 months ago

Amjad50 commented 8 months ago

This was triggering a bug in DwarfCfiIndex as:

match DwarfCfiIndex::try_new_eh_frame(&eh_frame, section_info) {
    Ok(index) => ModuleUnwindDataInternal::DwarfCfiIndexAndEhFrame {
        index,
        eh_frame: Arc::new(eh_frame),
        base_addresses: base_addresses_for_sections(section_info),
    },
    Err(_) => ModuleUnwindDataInternal::None,
}

try_new_eh_frame will call base_addresses_for_sections which will take the values, then the second time base_addresses_for_sections is called, it will get zeros bases, which is invalid and will not produce any frames

mstange commented 8 months ago

Oops, indeed!

mstange commented 7 months ago

I partially reverted this in 3e4aa185d16ef3b6535febc51b5656411a57ca06 because we don't actually need the data to be cloneable. We ask for the ranges multiple times, but we only ask for the section data once, so moving it is fine.

The macOS code inside samply was running into the Clone bound.