Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/TraceEvent/TraceEventStacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,14 @@ private bool ReasonableTopFrame(StackSourceCallStackIndex callStackIndex, Thread
return true;
}

// On Linux, <processName>!_start is an ELF entry point for C programs.
string processName = m_log.Threads[threadIndex].Process.Name;
if (string.Compare(moduleFileName, processName, StringComparison.OrdinalIgnoreCase) == 0)
{
m_goodTopModuleIndex = moduleFileIndex;
return true;
}

// The special processes 4 (System) and 0 (Kernel) can stay in the kernel without being broken.
if (moduleFile.FilePath.EndsWith("ntoskrnl.exe", StringComparison.OrdinalIgnoreCase))
{
Expand Down
4 changes: 3 additions & 1 deletion src/TraceEvent/TraceLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8570,10 +8570,12 @@ internal void AddUniversalDynamicSymbol(ProcessSymbolTraceData data, TraceProces
{
Debug.Assert(process != null);

// EndAddress is inclusive, so add one to get the exclusive length.
long symbolLength = (long)(data.EndAddress - data.StartAddress + 1);

// Skip symbols with invalid address ranges. The length parameter to ForAllUnresolvedCodeAddressesInRange
// is a signed long, so ranges whose unsigned size exceeds long.MaxValue (e.g., [0x0, 0xFFFFFFFFFFFFFFFF)
// from zeroed /proc/kallsyms on Linux without root) would overflow to a negative value and must be rejected.
long symbolLength = (long)(data.EndAddress - data.StartAddress);
if (symbolLength <= 0)
{
return;
Expand Down