Rollup merge of #97761 - RalfJung:vtable-validation, r=cjgillot
validating the vtable can lead to Stacked Borrows errors Fixes https://github.com/rust-lang/miri/issues/2123
This commit is contained in:
commit
11d8ae2c71
1 changed files with 8 additions and 0 deletions
|
@ -338,6 +338,10 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
|
|||
{ "invalid drop function pointer in vtable (not pointing to a function)" },
|
||||
err_ub!(InvalidVtableDropFn(..)) =>
|
||||
{ "invalid drop function pointer in vtable (function has incompatible signature)" },
|
||||
// Stacked Borrows errors can happen here, see https://github.com/rust-lang/miri/issues/2123.
|
||||
// (We assume there are no other MachineStop errors possible here.)
|
||||
InterpError::MachineStop(_) =>
|
||||
{ "vtable pointer does not have permission to read drop function pointer" },
|
||||
);
|
||||
try_validation!(
|
||||
self.ecx.read_size_and_align_from_vtable(vtable),
|
||||
|
@ -347,6 +351,10 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
|
|||
err_ub!(InvalidVtableAlignment(msg)) =>
|
||||
{ "invalid vtable: alignment {}", msg },
|
||||
err_unsup!(ReadPointerAsBytes) => { "invalid size or align in vtable" },
|
||||
// Stacked Borrows errors can happen here, see https://github.com/rust-lang/miri/issues/2123.
|
||||
// (We assume there are no other MachineStop errors possible here.)
|
||||
InterpError::MachineStop(_) =>
|
||||
{ "vtable pointer does not have permission to read size and alignment" },
|
||||
);
|
||||
// FIXME: More checks for the vtable.
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue