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

[LibOS] Fix sendfile syscall with negative offsets #2501

Closed vijaydhanraj closed 3 years ago

vijaydhanraj commented 3 years ago

Description of the changes

This commit handles negative offset passed to sendfile syscall by returning -EINVAL. Negative offsets maybe valid for some special files like /dev/(k)mem and /proc/<pid>/mem which can have large file offsets. But in graphene, these files are not emulated so it will be safe to return -EINVAL for negative offsets.

Also, this patch enables 2 sendfile ltp tests.

Signed-off-by: Vijay Dhanraj vijay.dhanraj@intel.com

Fixes #2364

How to test this PR?

Please run ltp-sgx tests.


This change is Reviewable