Re: [PATCH v3] rust_binder: add ownership assertion to Node::add_death
Alice Ryhl <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAH5fLgjk0BxY142AfJZC14ZYsU5_rO3NNSrP3oLm53pjy4yzyw@mail.gmail.com> |
On Tue, Jun 16, 2026 at 7:10 PM Georgios Androutsopoulos <[email protected]> wrote: > > The `// SAFETY:` comment in NodeDeath::set_cleared assumes that a > NodeDeath is never inserted into the death list of any Node other than > its owner. However, this invariant is not enforced by the safe function > Node::add_death, which inserts NodeDeath into the death list without > checking that death.node == self, leaving a risk for future code that > may miss this implicit invariant and cause undefined behavior. > > Add an assertion to make this precondition explicit and catch potential > violations early. > > Link: https://github.com/Rust-for-Linux/linux/issues/1237 > > Signed-off-by: Georgios Androutsopoulos <[email protected]> Reviewed-by: Alice Ryhl <[email protected]>