Skip to content

Fix "Grant should not exist" errors.

Jacob Lorentzon requested to merge 4lDO2/kernel:fix-invalid-grant-state into master

This is done by making sure that when empty() is called on a context, the grants Arc will be replaced with a new unused Arc, hence decrementing the refcount. Previously this was only done when the context was actually reaped. But, since there is no guarantee as far as I am aware about when this must happen, the grants could be completely leaked if two context exit before either one is reaped, thus leading to the error.

The only thing I found non-trivial, was that when running fexec directly in a multithreaded process, the grants would previously be kept for the newly-executed process if there are more than one thread, which I don't think was the intended behavior in the first place.

Edited by Jacob Lorentzon

Merge request reports