-
Notifications
You must be signed in to change notification settings - Fork 204
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
Integration with sanitizers #19
Comments
I tried to enable ASan as well but I ended up having to disable it in all functions that I ran it and ended up giving up... |
Yeah, this definitely will require substantial efforts, but also give us quite huge gains. |
Bugs found by UBSan (including earlier efforts by @stefanberger):
Bugs found by ASan:
|
|
Thanks for the great analysis of Could you mark this checkbox as done & strike-through or something in the very first message? Or @mkow should do it, I guess. |
I guess we could add this only to debug builds (so that it can be insecure) and then have such memory outside of the enclave in PAL SGX. This way we could uniformly handle this and not worry about in-enclave memory constraints. The minus would be it's constrained to debug builds, but you don't want to run asan on production anyway. But that's just for the future in case we ever come back to this idea. |
Security is not the problem, the shadow memory for ASan is already outside of enclave. The problem is that I did not get this approach to work at all, because some places depend on local variables being in-enclave. If they're not, then some PAL functions error out on such variables (because they accept only in-enclave pointers), SGX instructions such as EREPORT and EGETKEY fail... and I haven't checked further but possibly more surprises lie ahead. I'd rather not have to circumvent/fix all of these places. Since the quick-and-dirty approach I'm talking about also had a fatal flaw of, well, never freeing the memory, probably it would be better to keep a memory pool inside the enclave. But... even if we got this integration to work, it sounds annoying to maintain and easy to break. |
Thanks for the detailed summary, Paweł! |
Description of the problem
It would be good to enable some sanitizers in CI (e.g. AddressSanitizer from Clang) to allow for better and more reliable detection of low-level bugs.
Current plan:
(if feasible) Detect also use-after-return- skipped, see commentThe tricky part is that we're running without stdlib and manage memory on our own (especially on SGX), so most likely we'll need some hacks to get ASan working.
Previous work: @yamahata and @stefanberger ran GCC's UBSan (see gramineproject/graphene#724, gramineproject/graphene#871, gramineproject/graphene#2089, gramineproject/graphene#2094, gramineproject/graphene#2097, gramineproject/graphene#2101, gramineproject/graphene#2102, gramineproject/graphene#2103). It's much less powerful than ASan, but still something! I think we can try to add it to CI as a first step, to have at least something.
The text was updated successfully, but these errors were encountered: