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
CI: MemorySanitizer is erroring (ASAN job) #2579
Comments
I'm debugging now, posted the issue for any tips or pointers. I've never debugged memory sanitizer bugs before. |
Putting |
I was unable to reslove this today, here are my findings:
// Sanity, just ensure we can access the first element here.
if data[0] == 0xff {
panic!("first element of data is 0xff")
}
let pointer = data.as_c_ptr();
if pointer.is_null() {
panic!("pointer is null");
} No further ideas ATM. |
Had another go, I'm hesitant to say it but it might be a bug in the MemorySanitazer? Or else something odd is going on. I changed int rustsecp256k1_v0_9_2_ec_pubkey_parse(const rustsecp256k1_v0_9_2_context* ctx, rustsecp256k1_v0_9_2_pubkey* _pubkey, const unsigned char *input, size_t inputlen) {
rustsecp256k1_v0_9_2_ge Q;
VERIFY_CHECK(ctx != NULL);
rustsecp256k1_v0_9_2_pubkey pk;
rustsecp256k1_v0_9_2_pubkey *pubkey = &pk;
if (pubkey == NULL) {
return 1;
}
ARG_CHECK(pubkey != NULL);
memset(pubkey, 0, sizeof(*pubkey));
ARG_CHECK(input != NULL);
if (input == NULL) {
return 20;
}
if (input[0] == 4) {
return 0;
}
/*
* Array access inside this function call is causing MSAN error but the array access above is ok
*
* This makes me think the bug is not ours because there should be no problem passing
* an arg to another function within C code.
* */
if (!rustsecp256k1_v0_9_2_eckey_pubkey_parse(&Q, input, inputlen)) {
return 0;
}
if (!rustsecp256k1_v0_9_2_ge_is_in_correct_subgroup(&Q)) {
return 0;
}
rustsecp256k1_v0_9_2_pubkey_save(pubkey, &Q);
rustsecp256k1_v0_9_2_ge_clear(&Q);
return 1;
} |
@apoelstra if you get a chance can you give this ten minutes and give some pointers on which direction to look please? |
ooo, it might not be the |
MSAN also errors for Change let mut ret = [0_u8; 66];
let mut ret_len = 66;
let res = unsafe {
ffi::secp256k1_ec_pubkey_serialize(
ffi::secp256k1_context_no_precomp,
ret.as_mut_c_ptr(),
&mut ret_len,
self.as_c_ptr(),
flag,
)
}; Still gives
|
I cannot repro. When I try to run the test I get
|
Running in gdb everything seems fine. If I run in valgrind it says |
097a00b CI: Disable MSAN job (Tobin C. Harding) Pull request description: I believe there is currently a bug in the MemorySanitizer, when we pass various types across the FFI boundry MSAN gives a unititialized variable error: - `usize` passed as `size_t` (cannot be uninitialized) - byte slice passed as `const char *` In order to let other work continue disable the MSAN job. The issue is further described in #2579 ACKs for top commit: apoelstra: ACK 097a00b Tree-SHA512: 0252ef0bd21afd55e878e495be1182d5b45b54e931dca9eb2e111731acd889cb5f0eb38b670b239cfb8511af5bf2145875b8853bd919d46bc278de12cda93414
I wonder if we are hitting bitcoin-core/secp256k1#1506 |
Yes, this really looks like google/sanitizers#1614 |
In the linked libsecp issue fanquake says that the upstream problem should be fixed (in github actions), so maybe we can re-enable msan. But can maybe wait til after the release because futzing with CI is time-consuming and annoying. |
There is a bug in the memory sanitizer at the moment, for more info see - rust-bitcoin/rust-bitcoin#2600 - rust-bitcoin/rust-bitcoin#2579 As we did in `rust-bitcoin` temporarily disable MSAN in CI.
There is a bug in the memory sanitizer at the moment, for more info see - rust-bitcoin/rust-bitcoin#2600 - rust-bitcoin/rust-bitcoin#2579 As we did in `rust-bitcoin` temporarily disable MSAN in CI.
We are hitting an intermittent MemorySanitizer (MSAN) error, locally on
master
I can repro it every time but some CI runs are hitting it and some not:Network
in the public API #2541 hit it.Minimal Reproducer
Apply the following diff:
And run
RUSTUP_TOOLCHAIN=nightly contrib/run_task.sh bitcoin asan
The text was updated successfully, but these errors were encountered: