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

/snap/go/10489/src/crypto/internal/bigmod/nat_asm.go:21: misplaced compiler directive #354

Open
yqiao18 opened this issue Feb 12, 2024 · 13 comments

Comments

@yqiao18
Copy link

yqiao18 commented Feb 12, 2024

When I ran go-fuzz-build, I encountered this problem:
failed to execute go build: exit status 1

crypto/internal/bigmod

/snap/go/10489/src/crypto/internal/bigmod/nat_asm.go:21: misplaced compiler directive
Is this because the go that my program is using does not match the go that installed on my machine?

@wulie
Copy link

wulie commented Feb 12, 2024 via email

@josharian
Copy link
Collaborator

i just pushed a few commits that should help with this. please make sure you've got the very latest version of go-fuzz and try again. if that doesn't work, please provide a public-code-only complete fuzz file that doesn't build. thanks.

@yqiao18
Copy link
Author

yqiao18 commented Feb 13, 2024

Hello,
Is this command to get the latest version of go-fuzz?
go install github.com/dvyukov/go-fuzz/go-fuzz@latest github.com/dvyukov/go-fuzz/go-fuzz-build@latest
Should I run this command inside the package which I wanna fuzz?

@josharian
Copy link
Collaborator

go install github.com/dvyukov/go-fuzz/go-fuzz@latest github.com/dvyukov/go-fuzz/go-fuzz-build@latest

that should work

you should be able to run it anywhere 

@yqiao18
Copy link
Author

yqiao18 commented Feb 13, 2024

I still get the same problem. "misplaced compiler directive"

@josharian
Copy link
Collaborator

if that doesn't work, please provide a public-code-only complete fuzz file that doesn't build.

@yqiao18
Copy link
Author

yqiao18 commented Feb 13, 2024

package integration

import (
"crypto/x509"
)

func Fuzz(data []byte) int {
// Call the function you want to fuzz, e.g., x509.ParseCertificateRequest
_, err := x509.ParseCertificateRequest(data)
if err != nil {
return 0 // Tell go-fuzz this input didn't trigger a panic
}
return 1 // This input is interesting
}
I can successfully run the go-fuzz github's example, but cannot run the above code

@josharian
Copy link
Collaborator

sigh. i've fixed this bug so many times in so many ways. i'll look again next time i have the heart to. if you want to tackle it yourself, take a look at 7356175 and b1ce7bc -- the fix is very likely to be similar, and in the same area of code.

@yqiao18
Copy link
Author

yqiao18 commented Mar 4, 2024

The fix your provided to me is already there in the latest version of go-fuzz. However, I still have the same error:
/usr/local/go/src/crypto/internal/bigmod/nat_asm.go:21: misplaced compiler directive

Should I change the go-fuzz version to 1.14?

@wulie
Copy link

wulie commented Mar 4, 2024 via email

@hrissan
Copy link

hrissan commented Apr 4, 2024

I'm getting the same bug with the following latest versions

go.sum:
github.com/dvyukov/go-fuzz v0.0.0-20240203152606-b1ce7bc07150 h1:8ww/RtfHmtJSLk7nK/TspKZDdgDvvXwp0JMIIhJF35s=
github.com/dvyukov/go-fuzz v0.0.0-20240203152606-b1ce7bc07150/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=

go install github.com/dvyukov/go-fuzz/go-fuzz@latest github.com/dvyukov/go-fuzz/go-fuzz-build@latest

$ ~/go/bin/go-fuzz-build
failed to execute go build: exit status 1

crypto/internal/bigmod

/usr/local/go/src/crypto/internal/bigmod/nat_asm.go:21: misplaced compiler directive

@wulie
Copy link

wulie commented Apr 4, 2024 via email

@hrissan
Copy link

hrissan commented Apr 11, 2024

There is an workaround. You can avoid transpiling module in question.

$ ~/go/bin/go-fuzz-build -preserve crypto/internal/bigmod

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

No branches or pull requests

4 participants