Abort on bad unlock and safe core dumps
This commit is contained in:
parent
fbc2c08e07
commit
82b1a12f35
|
|
@ -27,6 +27,7 @@ job: &JOB
|
||||||
export OPENSSL_DIR=$HOME/openssl
|
export OPENSSL_DIR=$HOME/openssl
|
||||||
cargo run --manifest-path=systest/Cargo.toml --target $TARGET
|
cargo run --manifest-path=systest/Cargo.toml --target $TARGET
|
||||||
- run: |
|
- run: |
|
||||||
|
ulimit -c unlimited
|
||||||
export OPENSSL_DIR=$HOME/openssl
|
export OPENSSL_DIR=$HOME/openssl
|
||||||
export PATH=$OPENSSL_DIR/bin:$PATH
|
export PATH=$OPENSSL_DIR/bin:$PATH
|
||||||
if [ "${NO_RUN}" = "1" ]; then
|
if [ "${NO_RUN}" = "1" ]; then
|
||||||
|
|
@ -37,6 +38,14 @@ job: &JOB
|
||||||
--target $TARGET \
|
--target $TARGET \
|
||||||
--all-features \
|
--all-features \
|
||||||
$TEST_ARGS
|
$TEST_ARGS
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
mkdir -p /tmp/core_dumps
|
||||||
|
find . -name "core.*" -exec cp \{\} /tmp/core_dumps \;
|
||||||
|
cp target/$TARGET/debug/openssl-* /tmp/core_dumps
|
||||||
|
when: on_fail
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/core_dumps
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: deps-1.19.0-{{ checksum "Cargo.lock" }}-{{ checksum "~/lib_key" }}
|
key: deps-1.19.0-{{ checksum "Cargo.lock" }}-{{ checksum "~/lib_key" }}
|
||||||
paths:
|
paths:
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ use std::sync::{Mutex, MutexGuard};
|
||||||
use std::sync::{Once, ONCE_INIT};
|
use std::sync::{Once, ONCE_INIT};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
use std::process;
|
||||||
|
|
||||||
use libc::{c_int, c_char, c_void, c_long, c_uchar, size_t, c_uint, c_ulong};
|
use libc::{c_int, c_char, c_void, c_long, c_uchar, size_t, c_uint, c_ulong};
|
||||||
#[cfg(not(ossl101))]
|
#[cfg(not(ossl101))]
|
||||||
|
|
@ -746,7 +747,10 @@ unsafe extern "C" fn locking_function(mode: c_int, n: c_int, _file: *const c_cha
|
||||||
if mode & ::CRYPTO_LOCK != 0 {
|
if mode & ::CRYPTO_LOCK != 0 {
|
||||||
(*GUARDS)[n as usize] = Some(mutex.lock().unwrap());
|
(*GUARDS)[n as usize] = Some(mutex.lock().unwrap());
|
||||||
} else {
|
} else {
|
||||||
&(*GUARDS)[n as usize].take().expect("lock already unlocked");
|
if let None = &(*GUARDS)[n as usize].take() {
|
||||||
|
println!("lock {} already unlocked", n);
|
||||||
|
process::abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue