• 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
..
varnishadm Loading commit data...
varnishd Loading commit data...
varnishhist Loading commit data...
varnishlog Loading commit data...
varnishncsa Loading commit data...
varnishstat Loading commit data...
varnishtest Loading commit data...
varnishtop Loading commit data...
Makefile.am Loading commit data...
flint.lnt Loading commit data...