Bug 1723945 - nsSystemInfo.cpp: On non-x86_{32,64} Linux, CollectProcessInfo can silently fail and insert junk data into the process. r=nika.

This doesn't happen on any P1 platforms.  It affects all non-x86/x86_64
Linuxes though, in this example, aarch64-linux.  It causes Valgrind runs on
aarch64-linux to report hundreds of errors.  In short, attempts to read
various fields from /proc/cpuinfo fail, because `CollectProcessInfo()` assumes
that it is looking at a /proc/cpuinfo file from a x86_{32,64} target, but its
format is very different on non x86 targets.  Unfortunately the parsing fails,
but the failure is not detected, resulting in the uninitialised fields being
treated as if they contained real data.

The simple fix here is just to give default values for these fields.

Differential Revision: https://phabricator.services.mozilla.com/D123189
This commit is contained in:
Julian Seward 2021-09-13 09:43:36 +00:00
parent 2ecacd2e2d
commit 0dbf2be8a0

View File

@ -36,17 +36,17 @@ struct OSInfo {
};
struct ProcessInfo {
bool isWow64;
bool isWowARM64;
int32_t cpuCount;
int32_t cpuCores;
bool isWow64 = false;
bool isWowARM64 = false;
int32_t cpuCount = 0;
int32_t cpuCores = 0;
nsCString cpuVendor;
int32_t cpuFamily;
int32_t cpuModel;
int32_t cpuStepping;
int32_t l2cacheKB;
int32_t l3cacheKB;
int32_t cpuSpeed;
int32_t cpuFamily = 0;
int32_t cpuModel = 0;
int32_t cpuStepping = 0;
int32_t l2cacheKB = 0;
int32_t l3cacheKB = 0;
int32_t cpuSpeed = 0;
};
typedef mozilla::MozPromise<DiskInfo, nsresult, /* IsExclusive */ false>