Skip to content

Commit

Permalink
FileManagement: Throw a warning if /proc can't be opened
Browse files Browse the repository at this point in the history
We use this for ProcFD collision checking. Give a warning if it can't be
opened, also not doing the additional work when it fails.

This isn't likely to occur unless someone messes up their rootfs mounts.
  • Loading branch information
Sonicadvance1 committed Feb 13, 2025
1 parent 6651f9e commit 116268b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Source/Tools/LinuxEmulation/LinuxSyscalls/FileManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,15 @@ FileManager::FileManager(FEXCore::Context::Context* ctx)

// Keep an fd open for /proc, to bypass chroot-style sandboxes
ProcFD = open("/proc", O_RDONLY | O_CLOEXEC);

// Track the st_dev of /proc, to check for inode equality
struct stat Buffer;
auto Result = fstat(ProcFD, &Buffer);
if (Result >= 0) {
ProcFSDev = Buffer.st_dev;
if (ProcFD != -1) {
// Track the st_dev of /proc, to check for inode equality
struct stat Buffer;
auto Result = fstat(ProcFD, &Buffer);
if (Result >= 0) {
ProcFSDev = Buffer.st_dev;
}
} else {
LogMan::Msg::EFmt("Couldn't open `/proc`. Is ProcFS mounted? FEX won't be able to track FD conflicts");
}

UpdatePID(::getpid());
Expand Down

0 comments on commit 116268b

Please sign in to comment.