-
Notifications
You must be signed in to change notification settings - Fork 2
Implement error handling for borrow_tracker
#43
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
base: main
Are you sure you want to change the base?
Conversation
Fix query for image tag
bsan-rt/src/borrow_tracker/mod.rs
Outdated
| // Dropping the tree lock early as we already have our tree_ptr | ||
| // TODO: Validate that this drop does not lose us access to the tree pointer | ||
| core::mem::drop(tree_lock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly induces a race condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to hold onto the lock until after we finish with the BorrowTracker object---that way, other threads will be held up within BorrowTracker::new until the current execution finishes modifying the Tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, instead of manually calling core::mem::drop, we'd just have another field within BorrowTracker.
bsan-rt/src/borrow_tracker/mod.rs
Outdated
| // Dropping the tree lock early as we already have our tree_ptr | ||
| // TODO: Validate that this drop does not lose us access to the tree pointer | ||
| core::mem::drop(tree_lock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to hold onto the lock until after we finish with the BorrowTracker object---that way, other threads will be held up within BorrowTracker::new until the current execution finishes modifying the Tree.
bsan-rt/src/borrow_tracker/mod.rs
Outdated
| // Dropping the tree lock early as we already have our tree_ptr | ||
| // TODO: Validate that this drop does not lose us access to the tree pointer | ||
| core::mem::drop(tree_lock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, instead of manually calling core::mem::drop, we'd just have another field within BorrowTracker.
bsan-rt/src/borrow_tracker/mod.rs
Outdated
| prov: &'a Provenance, | ||
| ctx: &'a GlobalCtx, | ||
| allocator: BsanAllocHooks, | ||
| alloc_info: &'a mut AllocInfo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not safe to have this as a mutable borrow; even though we're locking the Tree, other threads can still potentially read the AllocInfo object.
Notes
Moved around some of the Error types from Tree to make
TreeError. Added-Zdylib-ltoflag toenv.rswhich makes build noticeably slower but is required for some procedural macros being utilized in thethiserror_no_stdcrate.TODO
Due to lots of error nesting, it is a little bit tedious to write out Errors. Thinking about refactoring with specialized macros to make error handling less tedious.
Closes #42