• Samuel Groß's avatar
    [sandbox] Fix serialization of NativeContext · a9990e08
    Samuel Groß authored
    When a NativeContext is being serialized, the NativeContext's
    microtask_queue is set to nullptr as it is not included in the snapshot.
    However, when the sandbox is enabled, this will only set the pointer in
    the external pointer table to nullptr, but not the handle stored in the
    object. This then causes the deserialized object to briefly be invalid,
    before it's microtask queue handle is (re-)initialized. If a GC runs
    during that timeframe, it will see an invalid external pointer handle,
    which may cause DCHECK failures.
    To fix this, this CL now introduces a generic mechanism for clearing and
    restoring external pointer slots for serialization.
    
    Bug: v8:13218
    Change-Id: I03c8779bbec0a42a0b66687e76c951b1887e6122
    Cq-Include-Trybots: luci.v8.try:v8_linux64_heap_sandbox_dbg_ng,v8_linux_arm64_sim_heap_sandbox_dbg_ng
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3850294Reviewed-by: 's avatarJakob Linke <jgruber@chromium.org>
    Commit-Queue: Samuel Groß <saelo@chromium.org>
    Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#82677}
    a9990e08
slots.h 13 KB