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

notes for turning on ASan and UBSan in the Rust test harness #97

Open
oconnor663 opened this issue Jun 28, 2020 · 0 comments
Open

notes for turning on ASan and UBSan in the Rust test harness #97

oconnor663 opened this issue Jun 28, 2020 · 0 comments

Comments

@oconnor663
Copy link
Member

oconnor663 commented Jun 28, 2020

(Note that we already use -fsanitize=address,undefined in the Makefile tests for the C implementation.)

Reddit user /u/gzk11059 gave some very helpful pointers. Based on that thread, here's a first start on running sanitizers against the C implementation.

cd c/blake3_c_rust_bindings
CC=clang CFLAGS="-fsanitize=address,undefined -fno-sanitize-recover=all" RUSTFLAGS=-Zsanitizer=address cargo +nightly test

I can confirm that if I add some undefined behavior like this:

int signed_overflow = 2147483647;
signed_overflow++;

and then run the command above, I get a failure like this:

test test::test_compare_reference_impl ... ../blake3.c:11:18: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../blake3.c:11:18 in 
@oconnor663 oconnor663 changed the title notes for adding ASan and UBSan testing notes for turning on ASan and UBSan in the Rust test harness Jun 28, 2020
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

1 participant