GeezerVison is showing github.com — native interop: fix syslog on Apple arm64, stop starting getprop by FreeAndNil · Pull Request #325 · apache/logging-log4net
Conversation
FreeAndNil
commented
Sep 21, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixed
LocalSyslogAppender passed a variadic argument to syslog(3), audit da18b6f-f046
- on Apple arm64 a variadic argument goes on the stack, a fixed one in a register, so the callee
read a slot the runtime never wrote: stack bytes in the system log, or a crash
- proved by a probe on macOS 26.6.2 arm64, green on Linux and x64
- variadic is not an option, CoreCLR refuses a
__arglist P/Invoke, so only the two fixed
parameters are declared and the record goes in as the format string with every % doubled
- logged text, record length and every platform that already worked are unchanged
Changed
- Android detection started a process, audit da18b6f-f048
SystemInfo ran getprop ro.build.user at type initialisation on every Unix host, off PATH,
so the first match there decided the answer
- now
/system/bin/getprop, and the platform itself off net462
- The
FormatMessage buffer was released by the wrong allocator, audit da18b6f-f045
- the API allocates with
LocalAlloc, the ref string marshalling freed it as COM task memory
- now
out IntPtr, PtrToStringUni over the returned length, LocalFree in a finally
- hygiene, not a fix: a probe found the block inside the process heap
Tests
- both probes are gone, each replaced by the regression test of its fix
- the f048 and f046 tests fail against the old code; f045 has none, hence hygiene
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
FreeAndNil
added a commit
that referenced
this pull request
Sep 21, 2026
- SystemInfo ran "getprop ro.build.user" on every Unix host, via PATH
- first PATH match decided the answer
- now /system/bin/getprop, plus the platform itself off net462
- System.Diagnostics.Process out of the startup path
audit da18b6f-f048
FreeAndNil
added a commit
that referenced
this pull request
Sep 21, 2026
- process level env var tests restore through a using, not by hand
- ProcessLevelEnvironmentVariable leaked the variable on a failed assert
- Machine and User targets keep cleaning up themselves, not covered
FreeAndNil
added a commit
that referenced
this pull request
Sep 21, 2026
- FormatMessage allocates with LocalAlloc, the ref string marshalling
freed it as COM task memory
- now out IntPtr, PtrToStringUni over the returned length, LocalFree in
a finally
- hygiene, not a fix: the probe found the block inside the process heap
- WindowsAllocatorProbeTest replaced by NativeErrorTest
audit da18b6f-f045
FreeAndNil
added a commit
that referenced
this pull request
Sep 21, 2026
- a variadic argument goes on the stack on Apple arm64, a fixed one in a
register, so the callee read the wrong slot
- declaring it variadic is out: CoreCLR refuses a __arglist P/Invoke
- only the two fixed parameters now, record as the format string with
every percent sign doubled
- logged text, length and platforms that worked stay as they were
- VariadicAbiProbeTest replaced by the escaping and signature tests
audit da18b6f-f046
FreeAndNil
changed the title
Feature/325 native interop
native interop: fix syslog on Apple arm64, stop starting getprop
Sep 21, 2026
- SystemInfo ran "getprop ro.build.user" on every Unix host, via PATH
- first PATH match decided the answer
- now /system/bin/getprop, plus the platform itself off net462
- System.Diagnostics.Process out of the startup path
audit da18b6f-f048
- process level env var tests restore through a using, not by hand
- ProcessLevelEnvironmentVariable leaked the variable on a failed assert
- Machine and User targets keep cleaning up themselves, not covered
- FormatMessage allocates with LocalAlloc, the ref string marshalling
freed it as COM task memory
- now out IntPtr, PtrToStringUni over the returned length, LocalFree in
a finally
- hygiene, not a fix: the probe found the block inside the process heap
- WindowsAllocatorProbeTest replaced by NativeErrorTest
audit da18b6f-f045
- a variadic argument goes on the stack on Apple arm64, a fixed one in a
register, so the callee read the wrong slot
- declaring it variadic is out: CoreCLR refuses a __arglist P/Invoke
- only the two fixed parameters now, record as the format string with
every percent sign doubled
- logged text, length and platforms that worked stay as they were
- VariadicAbiProbeTest replaced by the escaping and signature tests
audit da18b6f-f046
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 1, 2026
This was referenced Nov 12, 2026
This was referenced Nov 19, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|