News for hackers. Stuff that matters.
Re:An RFC that adds support for Rust to the Linux kernel by Gaelan on Wednesday April 14, 2021 @08:45PM (#26814947)
wrt the discussion about colored unsafe for interrupt safety, would it be possible to have functions that sleep (or whatever) take a zero-sized struct called NotInterrupt or something? Then entry points to Rust code that are known to not be called from interrupts (unsafely) construct a NotInterrupt, and the rest of the code just passes it around. I think with some clever use of phantom references, you can convince the borrow checker to prevent a NotInterrupt from outliving the context it was created for, and as it's a ZST, it should be zero-cost.
Re:An RFC that adds support for Rust to the Linux kernel by myrrlyn on Saturday April 17, 2021 @02:17PM (#26846274)
yeah this is a common pattern in runtime permissions modelling. it's a really cool trick and i hope it gets more awareness from cases like this