Skip to main content

restore_if_intact

Function restore_if_intact 

Source
fn restore_if_intact(
    r: &Req<'_>,
    pid: u32,
    addr: u64,
    orig: &[u8],
    written: &[u8],
)
Expand description

Puts orig back at addr in process pid if the memory still holds exactly the rewrite, i.e. written followed by the rest of orig.

A buffer that was freed or reused since the rewrite no longer matches and is left alone: writing into it would corrupt whatever lives there now (a reused stack frame, an allocator’s free list).

§Arguments

  • r - The notification, for logging.
  • pid - Process whose memory holds the string.
  • addr - Address of the string.
  • orig - The original bytes.
  • written - The bytes written over the front of them.