• Dridi Boukelmoune's avatar
    ws_emu: Introduce the workspace emulator · cfa0983d
    Dridi Boukelmoune authored
    The goal of the workspace emulator is to replicate the regular workspace
    behavior with individual allocations and make it work transparently.
    
    It's the successor of the workspace sanitizer from #3320 with notable
    differences:
    
    - enabled at configure time instead of run time
    - in a separate source file instead of mixed in
    - using sparse allocations instead of built-in red zones
    
    This means that the workspace emulator can be combined with regular
    sanitizer, in particular asan and lsan. If available, asan's public
    interface is used to mitigate the possible overflow of a reservation
    after some of it was released.
    
    Even without sanitizers, the fact that we integrate with jemalloc by
    default and enable its abort and junk options in varnishtest is enough
    to detect a use-after-free in some cases.
    
    With sanitizers though, the workspace emulator can observe #3550.
    
    One drawback is that the logic is split in two files, and some functions
    are identical in the two files. It might be possible to split cache_ws.c
    into something like cache_ws_alloc.c and cache_ws_util.c for example.
    
    Closes #3320
    Refs #3550
    Refs #3600
    cfa0983d
r03353.vtc 487 Bytes