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

Possible panic issue in set_for_current #345

Open
kitcatier opened this issue Mar 17, 2023 · 0 comments
Open

Possible panic issue in set_for_current #345

kitcatier opened this issue Mar 17, 2023 · 0 comments

Comments

@kitcatier
Copy link

kitcatier commented Mar 17, 2023

Hello, I found a soundness issue in this crate.

pub fn set_for_current(core_id: CoreId) {
tracing::trace!("Executor: placement: set affinity on core {}", core_id.id);
set_for_current_helper(core_id);
}

Here's a quick example of this issue:

extern crate bastion_executor;
use bastion_executor::placement::CoreId;

fn main() {
    let a:CoreId = CoreId { id: 771157545605903283 };
    let _ = bastion_executor::placement::set_for_current(a);
}

This outputs:

thread 'main' panicked at 'attempt to shift left with overflow', C:\Users\.cargo\registry\src\github.com-1ecc6299db9ec823\bastion-executor-0.4.2\src\placement.rs:216:31
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library\std\src\panicking.rs:575
   1: core::panicking::panic_fmt
             at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library\core\src\panicking.rs:65
   2: core::panicking::panic
             at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c/library\core\src\panicking.rs:115
   3: bastion_executor::placement::windows::set_for_current
             at C:\Users\.cargo\registry\src\github.com-1ecc6299db9ec823\bastion-executor-0.4.2\src\placement.rs:216
   4: bastion_executor::placement::set_for_current_helper
             at C:\Users\.cargo\registry\src\github.com-1ecc6299db9ec823\bastion-executor-0.4.2\src\placement.rs:180
   5: bastion_executor::placement::set_for_current
             at C:\Users\.cargo\registry\src\github.com-1ecc6299db9ec823\bastion-executor-0.4.2\src\placement.rs:22
   6: hello::main
             at .\src\main.rs:14
   7: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/73c9eaf21454b718e7c549984d9eb6e1f75e995c\library\core\src\ops\function.rs:510
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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