diff --git a/analyzer/opcode/opcode.go b/analyzer/opcode/opcode.go index ba33203..8e23166 100644 --- a/analyzer/opcode/opcode.go +++ b/analyzer/opcode/opcode.go @@ -45,10 +45,6 @@ func (op *opcode) Analyze(path string, withTrace bool) ([]*analyzer.Issue, error if err != nil { // non-reachable portion ignored continue } - if !withTrace { - source.CallStack = nil - } - issue := &analyzer.Issue{ Severity: analyzer.IssueSeverityCritical, CallStack: source, @@ -58,6 +54,9 @@ func (op *opcode) Analyze(path string, withTrace bool) ([]*analyzer.Issue, error if common.ShouldIgnoreSource(source, op.profile.IgnoredFunctions) { issue.Severity = analyzer.IssueSeverityWarning } + if !withTrace { + source.CallStack = nil + } issues = append(issues, issue) } } diff --git a/analyzer/syscall/asm_syscall.go b/analyzer/syscall/asm_syscall.go index 430c618..e6d61dc 100644 --- a/analyzer/syscall/asm_syscall.go +++ b/analyzer/syscall/asm_syscall.go @@ -67,9 +67,6 @@ func (a *asmSyscallAnalyser) Analyze(path string, withTrace bool) ([]*analyzer.I if err != nil { // non-reachable portion ignored continue } - if !withTrace { - source.CallStack = nil - } severity := analyzer.IssueSeverityCritical if common.ShouldIgnoreSource(source, a.profile.IgnoredFunctions) { @@ -80,7 +77,9 @@ func (a *asmSyscallAnalyser) Analyze(path string, withTrace bool) ([]*analyzer.I message = fmt.Sprintf("Potential NOOP Syscall Detected: %d", syscall.Number) severity = analyzer.IssueSeverityWarning } - + if !withTrace { + source.CallStack = nil + } issues = append(issues, &analyzer.Issue{ Severity: severity, Message: message, diff --git a/common/entrypoint.go b/common/entrypoint.go index 7b462af..4d7d116 100644 --- a/common/entrypoint.go +++ b/common/entrypoint.go @@ -13,14 +13,14 @@ func ProgramEntrypoint(arch string) func(function string) bool { function == "runtime.schedinit" || function == "runtime.newproc" || function == "runtime.mstart" || - function == "main.main" || // main + strings.Contains(function, "main.main") || // main and closures or anonymous functions strings.Contains(function, ".init.") || // all init functions strings.HasSuffix(function, ".init") // vars } case "mips64": return func(function string) bool { return function == "runtime.rt0_go" || // start point of a go program - function == "main.main" || // main + strings.Contains(function, "main.main") || // main and closures or anonymous functions strings.Contains(function, ".init.") || // all init functions strings.HasSuffix(function, ".init") // vars }