Skip to content

Commit

Permalink
ensure both kinds of TLS are stored as static roots
Browse files Browse the repository at this point in the history
  • Loading branch information
max-heller committed Jun 10, 2023
1 parent ddfbdd1 commit 2fd2ed1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/concurrency/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
for ptr in
this.machine.threads.thread_terminated(this.machine.data_race.as_mut(), current_span)
{
if let Some(alloc) = ptr.provenance.get_alloc_id() {
trace!("Main thread thread-local static stored as static root: {:?}", alloc);
this.machine.static_roots.push(alloc);
}
this.deallocate_ptr(ptr.into(), None, MiriMemoryKind::Tls.into())?;
}
Ok(())
Expand Down
6 changes: 5 additions & 1 deletion src/shims/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ impl<'tcx> TlsData<'tcx> {
if let Some(alloc) = (new_data.to_pointer(cx).ok())
.and_then(|ptr| ptr.provenance.and_then(|prov| prov.get_alloc_id()))
{
trace!("TLS key {} for main thread stored as static root", key);
trace!(
"TLS key {} for main thread stored as static root: {:?}",
key,
alloc,
);
static_roots.push(alloc);
}
}
Expand Down

0 comments on commit 2fd2ed1

Please sign in to comment.