mystikos icon indicating copy to clipboard operation
mystikos copied to clipboard

Check for bad address in syscalls

Open mikbras opened this issue 3 years ago • 2 comments

Ideally the Mystikos kernel may check for bad addresses passed from user space and raise an EFAULT error. Add a new myst_is_badd_addr function that checks whether the given address is mapped or not (using the mprotect vector). One problem with this approach is that it does not work for brk acquired memory.

mikbras avatar May 27 '21 15:05 mikbras

This is a critical issue and is causing a number of tests to hang that pass invalid pointers to various syscalls. The hangs are because we are crashing while holding a lock, then another test is starting within the same instance of the kernel and then gets caught on the same lock that previously was not unlocked. All parameter pointers that are passed to syscalls need to be validated and need 2 alternatives:

  • Can kernel read from this pointer. Will also return false if myst_is_bad_addr() returns false
  • Can kernel write to this pointer. Again returning false if it is a bad address as well.

paulcallen avatar May 28 '21 18:05 paulcallen

Reopen the issue. This requires generalizing the new myst_is_badd_addr check introduced by #683.

mingweishih avatar Aug 13 '21 17:08 mingweishih