Zeke-OS / zeke

A POSIX-like OS for ARM processors.
Other
86 stars 9 forks source link

Simplified OOM handling #141

Open OlliV opened 7 years ago

OlliV commented 7 years ago

The issue is two fold, the usual case is that a syscall gets ENOMEM as a result of a call to a function declared in kmalloc.h, and the rarer case is that a kernel subsystem runs out of memory and can't continue proper operation. In the former case it would be a lot easier to just quit instead of trying to rollback and keep half-operational. These code paths are practically never tested properly.

The first case is quite often a result of the user passing an absurdly huge buffer size as an argument, in which case we should actually do input validation and not even try to allocate a kernel buffer for the data. Usually instead of allocating a kernel buffer uio buffer wrapping should be preferred, which reads and writes directly from and to the user space. The only problem is that it makes input validation impossible in case it's necessary, because another thready could alter the data while the other thread is executing the syscall code.

OlliV commented 7 years ago

https://github.com/Zeke-OS/zeke/issues/142

OlliV commented 4 years ago

150

OlliV commented 3 years ago

What is also being done is moving back to statically allocate as much as possible. This will make the boot procedure faster and more reliable.