• Oran Agra's avatar
    Scripts that declare the `no-writes` flag are implicitly `allow-oom` too. (#10699) · b0e18f80
    Oran Agra authored
    Scripts that have the `no-writes` flag, cannot execute write commands,
    and since all `deny-oom` commands are write commands, we now act
    as if the `allow-oom` flag is implicitly set for scripts that set the `no-writes` flag.
    this also implicitly means that the EVAL*_RO and FCALL_RO commands can
    never fails with OOM error.
    
    Note about a bug that's no longer relevant:
    There was an issue with EVAL*_RO using shebang not being blocked correctly
    in OOM state:
    When an EVAL script declares a shebang, it was by default not allowed to run in
    OOM state.
    but this depends on a flag that is updated before the command is executed, which
    was not updated in case of the `_RO` variants.
    the result is that if the previous cached state was outdated (either true or false),
    the script will either unjustly fail with OOM, or unjustly allowed to run despite
    the OOM state.
    It doesn't affect scripts without a shebang since these depend on the actual
    commands they run, and since these are only read commands, they don't care
    for that cached oom state flag.
    it did affect scripts with shebang and no allow-oom flag, bug after the change in
    this PR, scripts that are run with eval_ro would implicitly have that flag so again
    the cached state doesn't matter.
    
    p.s. this isn't a breaking change since all it does is allow scripts to run when they
    should / could rather than blocking them.
    b0e18f80
script.c 20.9 KB