gramineproject / graphene

Graphene / Graphene-SGX - a library OS for Linux multi-process applications, with Intel SGX support
https://grapheneproject.io
GNU Lesser General Public License v3.0
771 stars 260 forks source link

[Pal/Linux-SGX] Restrict possible error codes on OCALL returns #2621

Closed dimakuv closed 3 years ago

dimakuv commented 3 years ago

Description of the changes

As part of OCALL hardening, on OCALL return, we now verify and restrict possibly malicious return values. In most OCALL cases, we check against the set of permissible error codes (taken from corresponding syscall man pages and combined together for multi-syscall OCALLs).

Fixes #634.

How to test this PR?

All tests must pass. Must run several times to be sure.


This change is Reviewable

dimakuv commented 3 years ago

Jenkins, retest this please (first time was successful, running again just to check)

dimakuv commented 3 years ago

Jenkins, retest this please (Jenkins-Debug-18.04 timed out on fcntl14 -- looks like legit timeout; Jenkins-SGX-20.04 failed on test_libos.TC_80_Socket.test_022_poll_closed_fd, known issue fixed by Borys's PR).

Note that all my local 200 runs of fcntl14 succeeded, but the test is indeed pretty slow.

boryspoplawski commented 3 years ago

Jenkins, retest this please (last time was successful, running again just to check)

boryspoplawski commented 3 years ago

Jenkins, retest this please (last time was successful, running again just to check)

dimakuv commented 3 years ago

Jenkins, retest Jenkins-20.04 please (writev07 and fcntl14 timed out...)

dimakuv commented 3 years ago

Jenkins, retest this please (just to be sure)