From 58455035e09136222a58b400de1e9f439fa38239 Mon Sep 17 00:00:00 2001 From: hanako mumei <81144685+2501babe@users.noreply.github.com> Date: Fri, 5 Apr 2024 05:14:19 -0700 Subject: [PATCH] clone --- programs/bpf_loader/src/syscalls/sysvar.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/programs/bpf_loader/src/syscalls/sysvar.rs b/programs/bpf_loader/src/syscalls/sysvar.rs index a56d1f4265a5a3..94e901759d5a3c 100644 --- a/programs/bpf_loader/src/syscalls/sysvar.rs +++ b/programs/bpf_loader/src/syscalls/sysvar.rs @@ -16,7 +16,11 @@ fn get_sysvar( )?; let var = translate_type_mut::(memory_mapping, var_addr, check_aligned)?; - *var = sysvar?; + // this clone looks unecessary, but it exists to zero out trailing alignment bytes + // it is unclear whether this should ever matter + // but there are tests using MemoryMapping that expect to see this + // we preserve the previous behavior out of an abundance of caution + *var = sysvar?.clone(); Ok(SUCCESS) }