Skip to content

Commit 0d1e276

Browse files
committed
Added bsan_load_prov and bsan_store_prov impl
1 parent cff7d1e commit 0d1e276

File tree

1 file changed

+7
-6
lines changed
  • src/tools/bsan/bsan-rt/src

1 file changed

+7
-6
lines changed

src/tools/bsan/bsan-rt/src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,17 @@ extern "C" fn bsan_shadow_clear(addr: usize, access_size: usize) {}
257257
/// Loads the provenance of a given address from shadow memory and stores
258258
/// the result in the return pointer.
259259
#[no_mangle]
260-
extern "C" fn bsan_load_prov(prov: *mut MaybeUninit<Provenance>, addr: usize) {
261-
unsafe {
262-
(*prov).write(Provenance::null());
263-
}
260+
unsafe extern "C" fn bsan_load_prov(prov: *mut Provenance, address: usize) {
261+
let result = global_ctx().shadow_heap().load_prov(address);
262+
*prov = result;
264263
}
265264

266265
/// Stores the given provenance value into shadow memory at the location for the given address.
267266
#[no_mangle]
268-
extern "C" fn bsan_store_prov(prov: *const Provenance, addr: usize) {}
269-
267+
unsafe extern "C" fn bsan_store_prov(provenance: *const Provenance, address: usize) {
268+
let heap = &(*global_ctx()).shadow_heap();
269+
heap.store_prov(provenance, address);
270+
}
270271
/// Pushes a shadow stack frame
271272
#[no_mangle]
272273
extern "C" fn bsan_push_frame(span: Span) {}

0 commit comments

Comments
 (0)