pub unsafe fn try_recommit(
base: *mut u8,
start: usize,
end: usize,
) -> Result<(), VmemError>Expand description
Fallible recommit: Ok(()) if the range is now committed (or was a
well-formed no-op), Err(VmemError::invalid_argument()) if the offsets
violated the contract (misaligned, or start > end), Err(VmemError)
carrying the OS cause on genuine commit failure.
§Safety
Same contract as recommit, with the bound restated here rather than
only referenced (task #1229/F6): this function is the one that actually
reaches the backend — its non-mock arm calls recommit_pages_impl
directly, and recommit forwards through here — so a caller auditing
only this section must see it. base must be the
as_ptr of a live reservation whose
[base+start, base+end) range was previously decommitted, and
end <= reservation.len() — passing a larger end is undefined
behavior (the backend computes base.add(start) and nothing from
end; with start <= end the bound is what keeps that offset
in-bounds and the OS call’s span [base+start, base+end) inside the
reservation), a strictly worse violation than the
page_size()-multiple / start <= end contract, which merely returns
Err(VmemError::invalid_argument()), never UB.