Skip to content

Commit

Permalink
Auto merge of #3517 - RalfJung:env-vars, r=RalfJung
Browse files Browse the repository at this point in the history
env: split up Windows and Unix environment variable handling

On Windows, manage them entirely outside the AM state; this also means we no longer report any data races for environment variable memory.

Fixes rust-lang/rust#124411
  • Loading branch information
bors committed Apr 26, 2024
2 parents ec28d38 + c53d44b commit 6b787f9
Show file tree
Hide file tree
Showing 10 changed files with 614 additions and 530 deletions.
11 changes: 5 additions & 6 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use rustc_target::spec::abi::Abi;

use crate::{
concurrency::{data_race, weak_memory},
shims::unix::FdTable,
shims::unix,
*,
};

Expand Down Expand Up @@ -439,8 +439,7 @@ pub struct MiriMachine<'mir, 'tcx> {
/// Ptr-int-cast module global data.
pub alloc_addresses: alloc_addresses::GlobalState,

/// Environment variables set by `setenv`.
/// Miri does not expose env vars from the host to the emulated program.
/// Environment variables.
pub(crate) env_vars: EnvVars<'tcx>,

/// Return place of the main function.
Expand All @@ -465,9 +464,9 @@ pub struct MiriMachine<'mir, 'tcx> {
pub(crate) validate: bool,

/// The table of file descriptors.
pub(crate) fds: shims::unix::FdTable,
pub(crate) fds: unix::FdTable,
/// The table of directory descriptors.
pub(crate) dirs: shims::unix::DirTable,
pub(crate) dirs: unix::DirTable,

/// This machine's monotone clock.
pub(crate) clock: Clock,
Expand Down Expand Up @@ -642,7 +641,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
tls: TlsData::default(),
isolated_op: config.isolated_op,
validate: config.validate,
fds: FdTable::new(config.mute_stdout_stderr),
fds: unix::FdTable::new(config.mute_stdout_stderr),
dirs: Default::default(),
layouts,
threads: ThreadManager::default(),
Expand Down
Loading

0 comments on commit 6b787f9

Please sign in to comment.