Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: exception at unknown PC on Windows when using webroot anti-virus #41138

Closed
wa2nfn opened this issue Aug 30, 2020 · 30 comments
Closed

runtime: exception at unknown PC on Windows when using webroot anti-virus #41138

wa2nfn opened this issue Aug 30, 2020 · 30 comments

Comments

@wa2nfn
Copy link

@wa2nfn wa2nfn commented Aug 30, 2020

What version of Go are you using (go version)?

$ go version 1.15 windows amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\owner\AppData\Local\go-build
set GOENV=C:\Users\owner\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\owner\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\owner\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\owner\AppData\Local\Temp\go-build564260466=/tmp/go-build -gno-record-gcc-switches

What did you do?

Windows did an update. I updated to go 1.15

windows 1904.450

I built and ran my code which has NOT changed. It appeared ok. Then intermittently got the runtime exception about unknown pc. I rebuilt, and ran with as: go run, go build, go build -ldflags="-s -w" (my normal build) it SEEMED more likely to fail with -w.
It SEEMED to work until the build with the -w flag, then again intermittently failed without any of the run/build approaches.
Decided to eliminate my code to see if it was the env, or my pc memory.

So I wrote std HelloWorld.go and still intermittently got the issue.

Below is latest run of my code built with both flags, first run OK, Enter the cmd again and this time failure as shown below.

What did you expect to see?

$ ./mcpt.exe

mcpt version: 1.2.1 08/23/2020 Copyright 2020

Error: Either you forgot a required option, or you are a New User.

    New User -
            run: mcpt -help=tour
            or

            run: mcpt -help
            to review options

            or see the MCPT User Guide.

$ go version
go version go1.15 windows/amd64

owner@Mr-Finn MINGW64 ~/TTT/NEW/MCPT
$ go env
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\owner\AppData\Local\Temp\go-build280805674=/tmp/go-build -gno-record-gcc-switches

What did you see instead?

$ ./mcpt.exe
Exception 0xc0000005 0x0 0x7ffa795d0fff 0xa50000
PC=0xa50000

runtime: unknown pc 0xa50000
stack: frame={sp:0x92e820, fp:0x0} stack=[0x0,0x92ff00)
000000000092e720: 000000000092e768 000000000092e790
000000000092e730: 000000000092e758 000000000092e750
000000000092e740: 000000000092e754 0000000000170000
000000000092e750: 0000000000000000 0000000000000000
000000000092e760: 0000000000000000 0000000000000005
000000000092e770: 000000000092e8b8 00007ffa76f29f38
000000000092e780: 0000000000ab42c0 00007ffa793f46ce
000000000092e790: 00007ffa793d00e8 0000000000af6b20
000000000092e7a0: 00007ffa76f29f32 000000000092e7f0
000000000092e7b0: 004f0044004e0049 0053005c00530057
000000000092e7c0: 0000000000ab42c0 0000000000000000
000000000092e7d0: 0000000000aeaf20 006c006400050005
000000000092e7e0: 00007ffa76f29f32 0000000000000000
000000000092e7f0: 00007ffa00000000 00007ffa793d00e8
000000000092e800: 0000000000000000 0000000000000000
000000000092e810: 0000000000000001 00007ffa793f3783
000000000092e820: <0000000000000001 0000000000000000
000000000092e830: 0000000000000000 000000000092e928
000000000092e840: 0000000000000000 0000000000000000
000000000092e850: 0000000000000000 0000000000000000
000000000092e860: 0000000000af6b20 00007ffa79520f00
000000000092e870: 0000000000ab42c0 00007ffa79523520
000000000092e880: 000000000000097d 00007ffa7697ccb8
000000000092e890: 00007ffa7697a148 00007ffa79520f28
000000000092e8a0: 00007ffa79533d4f 00007ffa76970000
000000000092e8b0: 00007ffa79525b14 00007ffa79450aa0
000000000092e8c0: 0000000000000000 0000000000000000
000000000092e8d0: 0000000000000000 0000000000000000
000000000092e8e0: 0000000000af5f40 0000000000000044
000000000092e8f0: 0000000000000003 00007ffa7953a3f0
000000000092e900: 0000000000000001 000000000092eb00
000000000092e910: 0000000000aeaf20 00007ffa79431448
runtime: unknown pc 0xa50000
stack: frame={sp:0x92e820, fp:0x0} stack=[0x0,0x92ff00)
000000000092e720: 000000000092e768 000000000092e790
000000000092e730: 000000000092e758 000000000092e750
000000000092e740: 000000000092e754 0000000000170000
000000000092e750: 0000000000000000 0000000000000000
000000000092e760: 0000000000000000 0000000000000005
000000000092e770: 000000000092e8b8 00007ffa76f29f38
000000000092e780: 0000000000ab42c0 00007ffa793f46ce
000000000092e790: 00007ffa793d00e8 0000000000af6b20
000000000092e7a0: 00007ffa76f29f32 000000000092e7f0
000000000092e7b0: 004f0044004e0049 0053005c00530057
000000000092e7c0: 0000000000ab42c0 0000000000000000
000000000092e7d0: 0000000000aeaf20 006c006400050005
000000000092e7e0: 00007ffa76f29f32 0000000000000000
000000000092e7f0: 00007ffa00000000 00007ffa793d00e8
000000000092e800: 0000000000000000 0000000000000000
000000000092e810: 0000000000000001 00007ffa793f3783
000000000092e820: <0000000000000001 0000000000000000
000000000092e830: 0000000000000000 000000000092e928
000000000092e840: 0000000000000000 0000000000000000
000000000092e850: 0000000000000000 0000000000000000
000000000092e860: 0000000000af6b20 00007ffa79520f00
000000000092e870: 0000000000ab42c0 00007ffa79523520
000000000092e880: 000000000000097d 00007ffa7697ccb8
000000000092e890: 00007ffa7697a148 00007ffa79520f28
000000000092e8a0: 00007ffa79533d4f 00007ffa76970000
000000000092e8b0: 00007ffa79525b14 00007ffa79450aa0
000000000092e8c0: 0000000000000000 0000000000000000
000000000092e8d0: 0000000000000000 0000000000000000
000000000092e8e0: 0000000000af5f40 0000000000000044
000000000092e8f0: 0000000000000003 00007ffa7953a3f0
000000000092e900: 0000000000000001 000000000092eb00
000000000092e910: 0000000000aeaf20 00007ffa79431448
rax 0x7ffa7697d85c
rbx 0x7ffa7697d85a
rcx 0x41
rdi 0xffffffffffbadd11
rsi 0x0
rbp 0x7ffa769a9f00
rsp 0x92e820
r8 0x0
r9 0x0
r10 0x0
r11 0x97c
r12 0xc000007a
r13 0x0
r14 0x7ffa7697d85c
r15 0x7ffa793d0000
rip 0xa50000
rflags 0x10206
cs 0x33
fs 0x53
gs 0x2b

@ianlancetaylor ianlancetaylor changed the title runtime exception pc runtime: exception at unknown PC on Windows Aug 31, 2020
@ianlancetaylor ianlancetaylor added this to the Go1.16 milestone Aug 31, 2020
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Aug 31, 2020

@davecheney
Copy link
Contributor

@davecheney davecheney commented Aug 31, 2020

I have a feeling we had a report of a very similar issue about two weeks ago but search 🤷

@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Aug 31, 2020

I have a feeling we had a report of a very similar issue about two weeks ago but search 🤷

@davecheney do you mean #40401 or #40469 ? Does not look very similar to me.

@wa2nfn how much memory do you have in your PC? Also you did not show us the source code of your program. What does it look like? I would like to try to reproduce this issue myself. How can I do it?

Thank you.

Alex

@networkimprov
Copy link

@networkimprov networkimprov commented Aug 31, 2020

Alex, perhaps due to ASLR?

@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Aug 31, 2020

Alex, perhaps due to ASLR?

I would not know.

Alex

@networkimprov
Copy link

@networkimprov networkimprov commented Aug 31, 2020

@wa2nfn maybe try go build -buildmode=exe ...

@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Aug 31, 2020

@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Aug 31, 2020

@networkimprov
Copy link

@networkimprov networkimprov commented Aug 31, 2020

Would you be able to try it on a different Windows box running the same OS?

EDIT: Also it would help if you can post the code required for -help=tutors

@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Sep 1, 2020

@davecheney davecheney closed this Sep 1, 2020
@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Sep 5, 2020

Problem is back. Since last email, because I suspected it was my PC:

PC restored to windows 8.1 and then upgraded from microsoft to Windows 10Home Edition 10.0.1901 Build 19041

Reloaded all app from official sites: go 1.15, bash. I am building and running windows exe. Executing in a Windows terminal window.

As before I can run my code with a number of different options some create a large map and slice but other than than its parse, generate random numbers, create text and print it.

Again after a half dozens executions one after the other I will crash with the stack trace that ALWAYS has a complaint about a PC.

This build was again using ldflags -s -w

@networkimprov
Copy link

@networkimprov networkimprov commented Sep 5, 2020

cc @randall77 @aclements @prattmic

Possibly same as #40878

@networkimprov
Copy link

@networkimprov networkimprov commented Sep 6, 2020

@wa2nfn try this and post its output (assuming the Windows command prompt)

set GOTRACEBACK=system
./mcpt.exe ...
@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Sep 6, 2020

@networkimprov
Copy link

@networkimprov networkimprov commented Sep 6, 2020

We want output for a failure, yes.

A second pass with -buildmode=exe could be useful if it produces a different state on failure.

@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Sep 7, 2020

@networkimprov
Copy link

@networkimprov networkimprov commented Sep 7, 2020

skeptical of the cmd you gave me: set GOTRACEBACK=system ./mcpt.....

Just to clarify, it's two separate commands, and the "..." was meant as a reference to whatever params you've used previously.

@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Sep 7, 2020

@networkimprov
Copy link

@networkimprov networkimprov commented Sep 8, 2020

Hopefully we'll get some help from the runtime team, whom I cc'd above.

Ping back if there's no progress soon here or #40878

@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Sep 9, 2020

@networkimprov
Copy link

@networkimprov networkimprov commented Sep 9, 2020

Does mcpt use cgo? Mistakes with it can cause memory corruption.

Could you create a subset of mcpt, or small program, that reproduces the crash and share that?

Another thing to try is building with the race detector.

@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Sep 9, 2020

@networkimprov
Copy link

@networkimprov networkimprov commented Sep 9, 2020

Since you've isolated this to an external source, I think you're done :-)

FYI, cgo is a way to call C language libraries from a Go program.

@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Sep 9, 2020

@networkimprov
Copy link

@networkimprov networkimprov commented Sep 9, 2020

The Go ecosystem is relatively tiny compared to what you're used to.

@networkimprov
Copy link

@networkimprov networkimprov commented Sep 9, 2020

Can you retitle this issue to indicate that the problem was Webroot?

@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Sep 9, 2020

@ianlancetaylor ianlancetaylor changed the title runtime: exception at unknown PC on Windows runtime: exception at unknown PC on Windows when using webroot anti-virus Sep 9, 2020
@wa2nfn
Copy link
Author

@wa2nfn wa2nfn commented Sep 11, 2020

While the problem is the interaction with WEBROOT - when both WEBROOT wakes up and does its scanning AND the Go exe which run either in bash or the windows command line cause Go to dump the stack trace, its baffling to image what computer resource a 5 line HelloWorld would use that a "go build" or "go run" would not. There has never been a crash during compile, even if they run for 15-30 seconds on my device.

I would really hope that both the Go support would have a solution, as well as WEBROOT. In the case of WEBROOT they scan the exe and have no issue with it, Its just a runtime problem.

@networkimprov
Copy link

@networkimprov networkimprov commented Sep 11, 2020

Webroot may recognize the Go tooling binaries and leave them alone, and fail to recognize Go-built binaries.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Sep 11, 2020

I suggest that you contact WEBROOT and ask them what is going wrong. If there is something that we can change in the Go toolchain to avoid the problem, we can take a look at doing that.

But I suspect that @networkimprov is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.