Skip to content

Commit 2fd2ed1

Browse files
committed
ensure both kinds of TLS are stored as static roots
1 parent ddfbdd1 commit 2fd2ed1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/concurrency/thread.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
10731073
for ptr in
10741074
this.machine.threads.thread_terminated(this.machine.data_race.as_mut(), current_span)
10751075
{
1076+
if let Some(alloc) = ptr.provenance.get_alloc_id() {
1077+
trace!("Main thread thread-local static stored as static root: {:?}", alloc);
1078+
this.machine.static_roots.push(alloc);
1079+
}
10761080
this.deallocate_ptr(ptr.into(), None, MiriMemoryKind::Tls.into())?;
10771081
}
10781082
Ok(())

src/shims/tls.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ impl<'tcx> TlsData<'tcx> {
116116
if let Some(alloc) = (new_data.to_pointer(cx).ok())
117117
.and_then(|ptr| ptr.provenance.and_then(|prov| prov.get_alloc_id()))
118118
{
119-
trace!("TLS key {} for main thread stored as static root", key);
119+
trace!(
120+
"TLS key {} for main thread stored as static root: {:?}",
121+
key,
122+
alloc,
123+
);
120124
static_roots.push(alloc);
121125
}
122126
}

0 commit comments

Comments
 (0)