News for hackers. Stuff that matters.
Re:Simple Linux kernel memory corruption bug can lead to com... by athrowaway3z on Wednesday October 20, 2021 @02:18AM (#28927363)
I was typing a comment about how Rust wouldn't have made a difference for the race condition, but after reading through it again to be sure i'm now on the side that Rust would have errored on the original bug.

  spin_lock_irq(&tty->ctrl_lock);
  put_pid(real_tty->pgrp);
  real_tty->pgrp = get_pid(pgrp);
  spin_unlock_irq(&tty->ctrl_lock);
rustifying this would be

  let mut tty_lock = tty.ctrl_lock();
  put_pid(real_tty);
  real_tty.pgrp = get_pid(pgrp);
  std::mem::drop(tty_lock); 
Which would give an error that you are not allowed to mutate real_tty.pgrp.

There are no comments on this comment yet.