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 261 forks source link

Syscalls should fail with EBADF, but successfully goes through #2538

Closed anjalirai-intel closed 3 years ago

anjalirai-intel commented 3 years ago

Description of the problem

Following syscalls should fail with EBADF, but they are successful in Graphene. A file descriptor is obtained that can be used to perform operations that act purely at the file descriptor level, the file itself is not opened, the operations read(2), write(2), fchmod(2), fchown(2) fail with the error EBADF.

Steps to reproduce

Execute attached files open13_setup in linux environment and open13_run with graphene-direct $ ./open13_setup $ graphene-direct ./open13_run

Expected results

open13 1 TPASS : read(2) failed with EBADF open13 2 TPASS : write(2) failed with EBADF open13 3 TPASS : fchmod(2) failed with EBADF open13 4 TPASS : fchown(2) failed with EBADF open13 5 TPASS : fgetxattr(2) failed with EBADF

Actual results

open13 1 TFAIL : read(2) succeeded unexpectedly open13 2 TFAIL : write(2) failed unexpectedly, expected EBADF: TEST_ERRNO=SUCCESS(0): Success open13 3 TFAIL : fchmod(2) succeeded unexpectedly open13 4 TFAIL : fchown(2) succeeded unexpectedly

Labels

P0, bug open13.zip

sahason commented 3 years ago

@dimakuv Please assign this to me.

dimakuv commented 3 years ago

We merged the corresponding PR, but just to be explicit: the merged PR doesn't add the ability to use O_PATH (and thus fail on certain system calls with -EBADF) but instead explicitly disallows using O_PATH in Graphene (as it is not supported currently).