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

Segfault in 1.1.3 test suite #135

Closed
jagerman opened this issue Oct 6, 2019 · 5 comments
Closed

Segfault in 1.1.3 test suite #135

jagerman opened this issue Oct 6, 2019 · 5 comments

Comments

@jagerman
Copy link

jagerman commented Oct 6, 2019

When I build 1.1.3 (on amd64, debian sid, on a Ryzen cpu) and run ./randomx-tests I get a segfault (or sometimes Illegal instruction or some other failure) here which didn't happen in 1.1.2.

[79] Hash test 1a (interpreter)               ... PASSED
[80] Hash test 1b (interpreter)               ... PASSED
[81] Hash test 1c (interpreter)               ... PASSED
[82] Hash test 1d (interpreter)               ... PASSED
[83] Hash test 1e (interpreter)               ... PASSED
Segmentation fault

I bisected it to the PR #133 merge commit. I've tried a few different gcc and clang versions and all fail at the same place. Edit: also tried on an intel box, same failure.

@jagerman
Copy link
Author

jagerman commented Oct 6, 2019

But I don't see the segfault on the #134 PR branch.

@hyc
Copy link
Collaborator

hyc commented Oct 6, 2019

ASAN says there's a heap use-after-free bug here. Looking into it.

@tevador
Copy link
Owner

tevador commented Oct 6, 2019

@jagerman I fixed one bug in the tests in #134 here: https://github.com/tevador/RandomX/pull/134/files#diff-dcda6435c83281150294cbf602037aeeR1001-R1002

Looks like it's exactly where you get your segfault.

@hyc
Copy link
Collaborator

hyc commented Oct 6, 2019

The bug is in tests.cpp. At line 1001 https://github.com/tevador/RandomX/blob/master/src/tests/tests.cpp#L1001 it destroys the vm, but doesn't set the vm pointer to NULL. Then it calls initCache(), which tries to use the vm pointer because it's non-NULL. https://github.com/tevador/RandomX/blob/master/src/tests/tests.cpp#L26

jagerman added a commit to oxen-io/loki-randomXL that referenced this issue Oct 8, 2019
Upstream issue (and fix from) tevador#135 / tevador#134.
@tevador
Copy link
Owner

tevador commented Oct 11, 2019

Fixed in 1.1.4

@tevador tevador closed this as completed Oct 11, 2019
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

3 participants