fix(libc): restore syslog program-name fallback #9929
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9929"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by sandivd on 2026-10-22T22:13:44Z.
What
Restore libc syslog's program-name fallback using the existing libkernel program-name source, following the borrowed-pointer and caching behaviour in [FreeBSD 11.4 syslog.c](
github.com/freebsd/freebsd-src@8c639945a4/lib/libc/gen/syslog.c).The implementation:
openlogidentifier is supplied.closelogbehaviour.errnoacross the relevant syslog operations. The test also saves and restoreserrnoaroundstd::threadconstruction to remain portable across glibc versions.Remaining console-specific limitations and borrowed-pointer lifetime requirements are documented in [libc technical debt](
github.com/boykopovar/AnyPS5@fa25a4b798/docs/dev/debt/libc.md).Current integration
Rebased onto upstream/main at
[3a2b91981651569163768854a1fcdc7193b6667b](https://github.com/boykopovar/AnyPS5/commit/3a2b91981651569163768854a1fcdc7193b6667b).PR HEAD:
fa25a4b798ecf66300dd100d6c4d37bdb9c7c9daThe rebase preserves upstream declarations, API includes, source/test registrations, and unrelated technical debt entries. Production
Syslog.cppand the complete syslog regression test remain byte-identical to the previously published versions.The final change set contains six files. The syslog debt entry was shortened from 1,700 to 694 characters without removing the remaining limitations.
Implementation, testing, review, and PR preparation were assisted by OpenAI Codex.
Tested
The following results were obtained locally on the rebased HEAD
fa25a4b798ecf66300dd100d6c4d37bdb9c7c9da.Windows 11 — MSYS2 UCRT64, GCC 16.2.0
guest_syslog: 1/1 passed.guest_syslog_reload: 1/1 passed, including real libkernel unload/reload.Linux — WSL2 Ubuntu 24.04.1, GCC 13.3.0, glibc 2.39
guest_syslog.Isolated glibc 2.43 regression verification
Conventions and integration checks
git diff --check: passed.Exact commands and recorded CTest output for Windows
guest_syslog,guest_syslog_reload, and Linuxguest_syslogare included in the [verification comment](https://github.com/boykopovar/AnyPS5/pull/9929#issuecomment-6485952883).Known limitations
nghttp2install/export dependency failure, independently reproduced on unmodified upstream main. Runtime builds succeeded withCMAKE_SKIP_INSTALL_RULES=ON; no tests or assertions were disabled.action_required; no hosted product CI pass is claimed.Checklist
mainat the tested snapshot3a2b9198; no duplicate program-name fallback implementation was identified in the earlier overlap review, subject to its documented limitationsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T23:26:44Z.
Review: CHANGES_REQUESTED
The current head still contains the portability failure reported in the Linux run: the test saves
afterFirstbefore thestd::thread(...).join()call, then later asserts at the end that the calling thread errno is still2. The submitted test therefore treatsstd::threadas preserving errno, which is not guaranteed; the reported Ubuntu 26.04/glibc 2.43 run reproducesEINVALafter the join and failsguest_syslog5/5 until errno is saved/restored around that test step. Please keep the assertion focused on the syslog call’s errno-preservation behavior (for example, save and restore the caller errno around the thread operation), and rerunguest_syslogon Linux. This is a test portability failure, not a request to change production syslog errno semantics.I also rechecked this head (
47445ed34b46fe5bd78639f2f8b7831d7cd0fec4) against current main895f47f4eeaf56048b9a7080b7c01a9a47cf0ecf: diff-check and conventions pass, but the branch is 151 commits behind and current main has since changed the shared libc/kernel process and build paths. Please refresh before merge, preserve the program-name registration/unload behavior and both syslog test registrations, and rerun the focused test after the refresh. No hosted product tests are currently reported as run.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T22:21:02Z.
Review: CHANGES_REQUESTED
The reviewed code now includes the errno save/restore around thread creation, addressing the prior glibc portability failure. The author reports 15/15 focused Windows tests, 9/9 focused WSL tests, and five passing executions with isolated glibc 2.43; these are reports for reviewed contents, not fresh runs on this exact merged head. Current hosted conventions and labels pass, but product jobs are not shown as run.
The current head
57c6df1f5620c34835e450490fbc574c854e74d1is non-mergeable (DIRTY) againstmain; the latest merge of main is from October 26 and is 3,704 commits behind the current tip. Please resolve the current merge conflicts, confirm the declaration/include/test-fixture resolutions, and rerun the focusedguest_syslogtests on the resulting tree. This integration check blocks approval.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T23:56:24Z.
Review: CHANGES_REQUESTED
Re-checked — changes requested for current-main integration
The syslog integration changes are preserved and the author reports broad passing tests, but the branch still needs to be brought up to current
mainbefore approval.What I ran
98cc65ce6e4c8c9c160e946c54d2f73c34391e27; currentmainis3a2b91981651569163768854a1fcdc7193b6667b.git merge-tree --write-tree upstream/main upstream/pr-9929— clean preview, tree2163fe8b5702ab158244c941ccdeddfbca1609f9.git diff --check upstream/main...upstream/pr-9929— passed.python3 tools/check_conventions.py --base upstream/main --head upstream/pr-9929— 0 errors; it reports onedebt-lengthwarning for a 1,700-character entry.c9207624bc.Results
Findings
The update preserves the existing syslog behavior and the new program-name registration; the reported tests cover the focused path and the author appropriately does not claim hosted product CI passed. The current-main merge preview is clean.
However, the tested branch is based on
c9207624bc, while currentmainis3a2b91981651569163768854a1fcdc7193b6667b.CONTRIBUTING.mdrequires branches to stay up to date. Since currentmainalso changedlibc/CMakeLists.txt,libc/include/General.hpp, anddocs/dev/debt/libc.mdafter this branch point, please rebase onto currentmainand rerun the focusedguest_syslogtests on the resulting tree. The merge preview alone does not establish that the updated test/build integration passes.Non-blocking: the convention check flags the 1,700-character syslog debt entry for length; consider shortening it to the remaining gap and the behavior needed to explain it.
Sources
Not verified
I did not run the Windows reload/unload test, a Linux component build, the isolated glibc test, or any console behavior. Those results above are attributed to the author.
To get this to a good state
Rebase onto current
main, rerunguest_syslogandguest_syslog_reloadwhere available, and attach the exact updated head and output. I can then finish the review.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T02:12:19Z.
Review: APPROVED
Re-checked — approved
I reviewed exact head
fa25a4b798ecf66300dd1000?against currentmain(3a2b91981651569163768854a1fcdc7193b6667b). The program-name fallback integration and unload/reload handling are preserved, and the new head addresses the merge and focused-test issues from my previous review.What I ran
git merge-tree --write-tree upstream/main refs/remotes/review/9929git diff --check upstream/main...refs/remotes/review/9929python3 tools/check_conventions.py --base upstream/main --head refs/remotes/review/9929Syslog.cpp, process-name registration, test wiring, reload behavior, and the updated debt entry.Results
bf58f2af1d5a7fbd0da8a2a91a38ad5792686c1c)guest_syslogandguest_syslog_reloadpassedguest_syslogpassed in the 20-test run; isolated glibc 2.43 regression passed 5/5Raw local check output
Negative control
No separate negative-control run was relevant to this change. The reported
guest_syslog_reloadtest exercises the fallback before kernel load, while the kernel module is loaded, after unload, and after reload; it also checks that an explicit identity survives unload and is cleared bycloselog.Findings
No blocking findings on the reviewed head. The implementation registers the address of the kernel's program-name pointer, lazily caches its fallback for syslog output, and clears the registration when libkernel unloads. The tests cover registration lifecycle, borrowed program-name/identity storage, pointer mutation, errno preservation, and the existing mask/facility behavior. The Windows reload test is wired only on Windows, where the module unload behavior is relevant.
The author explicitly reports that the hosted product build remains
action_required; I do not count it as a passing hosted build. The supplied Windows, Linux, and isolated glibc results are attributed to the author.Sources
Not verified locally
I did not run the Windows DLL reload test, Linux component suite, isolated glibc regression, full product build, or console behavior locally. The focused Windows/Linux and glibc results above come from the author's report.