Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend dispatch_hook exception handling #46

Open
Soft opened this issue Oct 16, 2017 · 2 comments
Open

Backend dispatch_hook exception handling #46

Soft opened this issue Oct 16, 2017 · 2 comments

Comments

@Soft
Copy link
Contributor

Soft commented Oct 16, 2017

Currently, the code in Backend dispatch_hook is kind of messy. I guess it made sense when there was only a single back end. To be more specific, I would like for us to decide what should be done about exceptions. Currently we simply catch all the exceptions and log them but I wonder if this is the right approach to take. Previously, the method also caught some back end specific errors but that was lost with the move to multiple back ends.

What are your thoughts on the matter?

@Wenzel
Copy link
Member

Wenzel commented Oct 16, 2017

The reason why i was catched all these different exceptions here was just to have some statistic at the beginning.

I wanted to know if a hook failed because of a KeyError exception (so the hook implementation was faulty), or if libvmi failed to read the memory, or even if the memory access was not consistent (dump test on ObjectAttributes fields).

This self.stats was just to give me some visibility after running Nitro.

My idea here would be to replace that code by a generic exception handler, to catch everything.

try:
    hook(syscall, self)
except Exception as e:
    logging.exception(e)

It's critically important to catch any exception that could be raised while a hook is being processed.
Otherwise we are not ackowledging the kernel and the VM is frozen and has to be killed

@Wenzel
Copy link
Member

Wenzel commented Oct 16, 2017

Actually we are already catching everything.

I suggest we should remove these specific exception handlers, and just log the exception on the logging output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants