[kernel] Add automatic verification to syscalls
Since we have a DSL for specifying syscalls, we can create a verificaton method for each syscall that can cover most argument (and eventually capability) verification instead of doing it piecemeal in each syscall implementation, which can be more error-prone. Now a new _syscall_verify_* function exists for every syscall, which calls the real implementation. The syscall table for the syscall handler now maps to these verify functions. Other changes: - Updated the definition grammar to allow options to have a "key:value" style, to eventually support capabilities. - Added an "optional" option for parameters that says a syscall will accept a null value. - Some bonnibel fixes, as definition file changes weren't always properly causing updates in the build dep graph. - The syscall implementation function signatures are no longer exposed in syscall.h. Also, the unused syscall enum has been removed.
This commit is contained in:
@@ -34,6 +34,7 @@ class Context:
|
||||
pending = set()
|
||||
pending.add(filename)
|
||||
|
||||
from .parser import LarkError
|
||||
from .parser import Lark_StandAlone as Parser
|
||||
from .transformer import DefTransformer
|
||||
|
||||
@@ -47,7 +48,16 @@ class Context:
|
||||
path = self.find(name)
|
||||
|
||||
parser = Parser(transformer=DefTransformer(name))
|
||||
imps, objs, ints = parser.parse(open(path, "r").read())
|
||||
|
||||
try:
|
||||
imps, objs, ints = parser.parse(open(path, "r").read())
|
||||
except LarkError as e:
|
||||
import sys
|
||||
import textwrap
|
||||
print(f"\nError parsing {name}:", file=sys.stderr)
|
||||
print(textwrap.indent(str(e), " "), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
objects.update(objs)
|
||||
interfaces.update(ints)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user