• Nils Goroll's avatar
    An overflowed workspace must remain overflowed after WS_Reset() · 896151b4
    Nils Goroll authored
    We use workspace overflows to signal to bail out for example after a
    failing `VRT_SetHdr()`. This is a guarantee that if some serious issue
    occurred during processing, we rather send an error downstream than an
    incomplete response or the result of incomplete processing.
    
    We use the `WS_Snapshot() ...  WS_Reset()` pattern as some kind of
    second order workspace allocation where the called code itself uses
    `WS_Reserve()`.
    
    With this usage pattern, `WS_Reset()` called `ws_ClearOverflow(ws)`,
    potentially clearing the overflow bit from a previous relevant
    failure.
    
    We now avoid any other unintended clears of the overflow bit by
    splitting two functions:
    
    * WS_Rollback() is now what WS_Reset() used to be: It clears overflows
      and accepts the zero cookie for a reset-to-start
    
      It is only intended for use within varnishd and is thus declared
      in cache_varnishd.h
    
    * WS_Reset() does not touch the overflow bit any longer, ensuring that
      a once-overflowed workspace stays overflowed
    
    `WS_Snapshot()` now returns a magic value which gets recognized by
    `WS_Reset()` to ensure that the overflowed marker is still present.
    This serves two purposes:
    
    - better debugging and
    
    - a safety measure against passing a cookie from an already overflowed
      workspace to WS_Rollback()
    
    Fixes #3194
    896151b4
Name
Last commit
Last update
..
cache Loading commit data...
common Loading commit data...
fuzzers Loading commit data...
hash Loading commit data...
hpack Loading commit data...
http1 Loading commit data...
http2 Loading commit data...
mgt Loading commit data...
proxy Loading commit data...
storage Loading commit data...
waiter Loading commit data...
Makefile.am Loading commit data...
VSC_lck.vsc Loading commit data...
VSC_main.vsc Loading commit data...
VSC_mempool.vsc Loading commit data...
VSC_mgt.vsc Loading commit data...
VSC_sma.vsc Loading commit data...
VSC_smf.vsc Loading commit data...
VSC_smu.vsc Loading commit data...
VSC_vbe.vsc Loading commit data...
builtin.vcl Loading commit data...
flint.lnt Loading commit data...
flint.sh Loading commit data...
vclflint.lnt Loading commit data...
vclflint.sh Loading commit data...