Skip to content

Commit

Permalink
Merge #879
Browse files Browse the repository at this point in the history
879: epoch: Adjust MAX_OBJECTS r=taiki-e a=taiki-e

- Revert #552 to mitigate the risk of segmentation faults in buggy downstream implementations (see #869)
- Reduce MAX_OBJECTS on cfg(miri)

Co-authored-by: Taiki Endo <te316e89@gmail.com>
  • Loading branch information
bors[bot] and taiki-e authored Jul 22, 2022
2 parents c059aec + f2ca66b commit 6dc9be5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions crossbeam-epoch/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ use crate::sync::list::{Entry, IsElement, IterError, List};
use crate::sync::queue::Queue;

/// Maximum number of objects a bag can contain.
#[cfg(not(crossbeam_sanitize))]
const MAX_OBJECTS: usize = 62;
#[cfg(crossbeam_sanitize)]
#[cfg(not(any(crossbeam_sanitize, miri)))]
const MAX_OBJECTS: usize = 64;
// Makes it more likely to trigger any potential data races.
#[cfg(any(crossbeam_sanitize, miri))]
const MAX_OBJECTS: usize = 4;

/// A bag of deferred functions.
Expand Down Expand Up @@ -297,13 +298,14 @@ pub(crate) struct Local {

// Make sure `Local` is less than or equal to 2048 bytes.
// https://github.com/crossbeam-rs/crossbeam/issues/551
#[cfg(not(crossbeam_sanitize))] // `crossbeam_sanitize` reduces the size of `Local`
#[cfg(not(any(crossbeam_sanitize, miri)))] // `crossbeam_sanitize` and `miri` reduce the size of `Local`
#[test]
fn local_size() {
assert!(
core::mem::size_of::<Local>() <= 2048,
"An allocation of `Local` should be <= 2048 bytes."
);
// TODO: https://github.com/crossbeam-rs/crossbeam/issues/869
// assert!(
// core::mem::size_of::<Local>() <= 2048,
// "An allocation of `Local` should be <= 2048 bytes."
// );
}

impl Local {
Expand Down

0 comments on commit 6dc9be5

Please sign in to comment.