Repository navigation
fix(agc): read the Darwin environment with _NSGetEnviron - #16796
wanderingbug wants to merge 1 commit into
Conversation
The device-fault report used ::environ. Apple's header exposes that name as a macro, so the qualified lookup is not a global, and the macOS loader publishes the process environment through _NSGetEnviron. Linux still reads ::environ. Co-authored-by: devindevsec <devindevsec@users.noreply.github.com>
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
gabichuuuuu
left a comment
There was a problem hiding this comment.
Read a0e175fc0e. The device-fault environment dump now takes *_NSGetEnviron() on Apple, with <crt_externs.h> included under __APPLE__ only; Windows keeps _environ and Linux ::environ, so neither changes. One note: three other files in the same library read the environment through extern char** environ; and plain environ on every non-Windows host (FrameRecorder.cpp:29, HostReportSources.cpp:17, PerformanceTrace.cpp:29). If the macOS build accepts those, it's only the qualified ::environ spelling that breaks there; if not, they'd need the same treatment. Either way this change is fine.
AI-assisted: yes.
|
Ready to merge from my side, but the PR description fails the conventions check:
Please fill those template lines in (only you can answer AI-assisted); it merges once they pass. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
The change adds a macOS branch that reads the process environment through _NSGetEnviron, and the Windows and Linux branches stay as they were.
What I ran
- Head
a0e175fc0ef1267bc6efea3c985188e5774b253a, basemain. Diff reviewed from the review folder; head source read with the repository reader. No build and no test was run. - Files: 1 reviewed (
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp), read only in part: the two changed hunks and the surrounding block. 0 excluded.
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp 2540 2580
python3 repo_read.py search _NSGetEnviron
python3 repo_read.py search crt_externs.h
Results
| Check | Result | Note |
|---|---|---|
| Darwin branch and include | passed | Matches the diff at head |
| Windows and Linux branches | passed | Unchanged |
_NSGetEnviron use elsewhere |
passed | Same pattern in other files |
| Comments added by the diff | passed | None |
| macOS build at head | not run | Author's build was on another SHA |
Commands and raw output
repo_read.py search _NSGetEnviron
a0e175fc0ef1267bc6efea3c985188e5774b253a:core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp:2557: char** entries = *_NSGetEnviron();
a0e175fc0ef1267bc6efea3c985188e5774b253a:core/libs/prx/libSceLibcInternal/Spawn.cpp:454: if (hostEnvironment == nullptr) hostEnvironment = *_NSGetEnviron();
a0e175fc0ef1267bc6efea3c985188e5774b253a:core/libs/prx/libSceSystemService/LoadExec.cpp:204: const int error = posix_spawn(nullptr, target.c_str(), &actions, &attributes, pointers.data(), *_NSGetEnviron());
a0e175fc0ef1267bc6efea3c985188e5774b253a:core/libs/prx/libkernel/Pthread/src/MainThreadMacOs.cpp:162: *_NSGetEnviron() = CopyStrings(*_NSGetEnviron());
4 matching lines at a0e175fc0ef1.
repo_read.py search crt_externs.h
a0e175fc0ef1267bc6efea3c985188e5774b253a:core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp:77:#include <crt_externs.h>
a0e175fc0ef1267bc6efea3c985188e5774b253a:core/libs/prx/libSceLibcInternal/Spawn.cpp:31:#include <crt_externs.h>
a0e175fc0ef1267bc6efea3c985188e5774b253a:core/libs/prx/libSceSystemService/LoadExec.cpp:25:#include <crt_externs.h>
a0e175fc0ef1267bc6efea3c985188e5774b253a:core/libs/prx/libc/src/RunReport.cpp:45:#include <crt_externs.h>
a0e175fc0ef1267bc6efea3c985188e5774b253a:core/libs/prx/libkernel/Pthread/src/MainThreadMacOs.cpp:6:#include <crt_externs.h>
a0e175fc0ef1267bc6efea3c985188e5774b253a:core/libs/prx/libkernel/System/src/MimallocRestart.cpp:12:#include <crt_externs.h>
a0e175fc0ef1267bc6efea3c985188e5774b253a:core/libs/tests/GuestMainStackMove.cpp:2:#include <crt_externs.h>
7 matching lines at a0e175fc0ef1.
repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp 2540 2580 (excerpt, lines 2554–2560 of the output)
2554 #ifdef _WIN32
2555 char** entries = _environ;
2556 #elif defined(__APPLE__)
2557 char** entries = *_NSGetEnviron();
2558 #else
2559 char** entries = ::environ;
2560 #endif
Findings
Blocking
None.
Non-blocking
None.
Sources
- Changed hunks at head: VulkanDevice.cpp lines 76–78 and lines 2556–2557.
Not verified
- Compilation of
VulkanDevice.cppfor macOS at this head. The description says the build covered42f65a4b, and the publisheda0e175fc0ewas not rebuilt on the Mac. - The rest of
VulkanDevice.cpp(6,562 lines). Only the changed lines and lines 2540–2580 were read. The file is listed under reviewed in the review folder, so the review is not complete for APPROVE; this is why the event is COMMENT. - Runtime behaviour of the environment dump on macOS. Nothing was run.
- Linux and Windows builds. Those branches are unchanged code, but no build was run.
To get this to a good state
Nothing is required.
Optional:
- Build the macOS target at
a0e175fc0eand run the device-fault path once, so the published head has a build of its own and not only42f65a4b. - Leave the unchecked checklist items as they are until that run exists.
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
ligmaSec
left a comment
There was a problem hiding this comment.
The trial merge onto c1601e56d5 was clean. The new include and _NSGetEnviron lookup are both guarded by __APPLE__, and the change is limited to device-fault reporting. Please confirm the exact current head compiles with the native Apple SDK, since running the existing Linux fault-report controls cannot cover Darwin’s declaration. I reviewed this path in source.
AI-assisted: yes.
The device-fault report used ::environ. Apple's header exposes that name as a macro, so the qualified lookup is not a global, and the macOS loader publishes the process environment through _NSGetEnviron. Linux still reads ::environ.
What
Open #16801 (
fix/macos-test-compile,38bddbff44) edits onlyResourceRequest.cpp,RtcpTransportFeedback.cpp, andGuestCesGbSetters.cpp:<initializer_list>andResourceRequestBasevalue initialization. None of those symbols are in this pull request.On Apple,
VulkanDevice.cppreads the process environment with_NSGetEnvironfrom<crt_externs.h>. Linux still uses::environ.Tested
The combined
libsbuild compiledVulkanDevice.cppwith the overlay, and the MoltenVK square smoke later ran on the Apple M2 Max. Publisheda0e175fc0eis the same patch as tested42f65a4b, replayed cleanly ontodd00a9c54e. That published SHA was not rebuilt on the Mac. The validation-layer comparison withmainwas not run. Not tested on a second machine; no game tested.Checklist
main; no other open PR implements the same functions. Unchecked: parent isdd00a9c54e, and upstreammainis nowdaad891ea6. test: build the RTCP feedback, CES setter and NKWebKit request tests on macOS #16801 does not implement these functions. Other open pull requests were not fully scanned.//comments..mdfiles or images added to the repository3rdparty/change.mainwas not run on this head.