fix(engine): seed object name/type at create; fatal-only native crash logger

CreateObject hook reads _name/_type from the PublicWeenieDesc so off-thread lookups work before the 500 ms identity snapshot resolves names (empty for ~10 s after login).

SehTrampoline v2: stack sweep bounded by StackBase, per-thread guards for self-faults and SEH_* wrapper AVs, unhandled-exception filter for fatal crashes, NativeAOT-module AVs logged immediately, other first-chance AVs deferred to a ring flushed only if the process dies.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
BlankenshipG 2026-10-04 17:58:22 -04:00
commit a7cdbee135
6 changed files with 629 additions and 110 deletions

View file

@ -43,12 +43,24 @@ internal static class SehTrampoline
/// no managed callback / reverse-P/Invoke transition — so unlike the removed
/// managed CrashLogger VEH it cannot itself re-trigger a NativeAOT fail-fast on an
/// AC-owned thread. Writes the faulting 32-bit context + a module-resolved stack
/// sweep to <paramref name="logPath"/> for the 0xC0000005 (AV/CSE) and 0xC0000602
/// (RaiseFailFast) classes that bypass managed handlers. Observes only.
/// sweep (bounded by the thread's StackBase) to <paramref name="logPath"/> for FATAL
/// crashes only: unhandled exceptions (chained unhandled-exception filter), AVs in
/// NativeAOT code (which the runtime fail-fasts past every filter), and other
/// first-chance AVs only if the process dies shortly after. AVs caught by the SEH_*
/// wrappers and the logger's own faults are never written. Observes only.
/// </summary>
public static void InstallCrashLogger(string logPath)
{
try { _InstallCrashLogger(logPath); }
try
{
_InstallCrashLogger(logPath);
// v2+ logs fatal crashes only (unhandled-exception filter + NativeAOT-module AVs);
// v1 (no version export) logged every first-chance AV.
uint version = 1;
try { version = _SehTrampolineVersion(); }
catch (EntryPointNotFoundException) { }
RynthLog.Compat($"SehTrampoline: native crash logger installed (v{version}{(version >= 2 ? ", fatal-only" : ", logs every first-chance AV")}) -> {logPath}");
}
catch (Exception ex) { RynthLog.Compat($"SehTrampoline: InstallCrashLogger failed - {ex.GetType().Name}: {ex.Message}"); }
}
@ -104,6 +116,10 @@ internal static class SehTrampoline
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
private static extern void _InstallCrashLogger([MarshalAs(UnmanagedType.LPWStr)] string logPath);
[DllImport("RynthCore.SehTrampoline.dll", EntryPoint = "RC_SehTrampolineVersion",
CallingConvention = CallingConvention.Cdecl)]
private static extern uint _SehTrampolineVersion();
[DllImport("RynthCore.SehTrampoline.dll", EntryPoint = "RC_GetTagParserGuardAddress",
CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr _GetTagParserGuardAddress();