Rollup merge of #105207 - RalfJung:interpret-clobber-return, r=oli-obk
interpret: clobber return place when calling function Makes sure the callee cannot observe the previous contents of the return place, and the caller cannot read any of the old return place contents even if the function unwinds. I don't think we can test for this though, that would require some strange hand-written MIR. r? `````@oli-obk`````
This commit is contained in:
commit
aa0831092b
1 changed files with 4 additions and 0 deletions
|
@ -676,6 +676,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
return_to_block: StackPopCleanup,
|
||||
) -> InterpResult<'tcx> {
|
||||
trace!("body: {:#?}", body);
|
||||
// Clobber previous return place contents, nobody is supposed to be able to see them any more
|
||||
// This also checks dereferenceable, but not align. We rely on all constructed places being
|
||||
// sufficiently aligned (in particular we rely on `deref_operand` checking alignment).
|
||||
self.write_uninit(return_place)?;
|
||||
// first push a stack frame so we have access to the local substs
|
||||
let pre_frame = Frame {
|
||||
body,
|
||||
|
|
Loading…
Add table
Reference in a new issue