accellera-official / systemc

SystemC Reference Implementation
https://systemc.org/overview/systemc/
Apache License 2.0
451 stars 145 forks source link

qt stack mmap/munmap - Apply Guillaume Audeons changes manually #35

Closed joshwhieb closed 7 months ago

joshwhieb commented 1 year ago

https://forums.accellera.org/topic/6413-likely-memory-corruption-by-systemc/

Change the quick threads stack allocate/deallocate implementation to use mmap/munmap for the qt stack manually applied as Guillaume Audeon's git patch file from the forum doesn't apply cleanly. Guillaume might know the in depth details with how this addresses the seg fault and this also resolves my issues with assert + seg faults. I believe the linked forum is correct that using mprotect on malloc memory isn't supported via the documentation. If we use mmap we can also set the mprotect flags there.

Please feel free to pick this PR apart but I think we need to come to a resolution of the linked forum and get a new systemC tag out (2.3.5?) to help others avoid this. This error when encountered is a major hinderance for systemC usage when you find the right environment combination to run into it.

maehne commented 7 months ago

@AndrewGoodrich and @pah: Could you maybe have a look whether it is still relevant wrt. to recent updates in the PoC implementation?

pah commented 7 months ago

This one is superseded by the implementation in SystemC 3.0.

joshwhieb commented 7 months ago

I haven't seen this issue for a while as i've changed cluster environments it happens only in certain setups. If it's resolved by the next major systemC version implementation then we can close this out as a duplicate/invalid.