Skip to content

Put PerCoreScheduler::current_task into an InterruptRefCell #1847

@mkroening

Description

@mkroening

PerCoreScheduler::current_task is currently an Rc<RefCell<Task>>. Accesses to the RefCell are currently explicitly without_interrupts:

kernel/src/scheduler/mod.rs

Lines 576 to 584 in 53536a5

/// Remove a IO interface, which is named by the file descriptor
pub fn remove_object(&self, fd: FileDescriptor) -> io::Result<Arc<dyn ObjectInterface>> {
without_interrupts(|| {
let current_task = self.current_task.borrow();
let mut object_map = current_task.object_map.write();
object_map.remove(&fd).ok_or(Errno::Badf)
})
}

fbc6044 mistakenly removed without_interrupts from PerCoreScheduler::get_object, resulting in spurious panics at

let mut borrowed = self.current_task.borrow_mut();

It would be beneficial to use an InterruptRefCell instead of a RefCell to ensure interrupts are disabled.

Related: #1846

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions