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 lseek with large offsets #2485

Closed pwmarcz closed 3 years ago

pwmarcz commented 3 years ago

See recent issue #2478 (to be confirmed).

Description of the changes

lseek used an int, I fixed it and added a test.

(We're planning to stop using off_t internally, but it's unrelated to the current bug).

How to test this PR?

There is a new regression test, large_file. Before the fix, it displayed:

testing length 0x7fffffff
testing length 0x80000001
large_file: lseek(fd, -1, 2) = -2147483648 (ffffffff80000000): Success

And it looks like the length 0xffffffff actually causes lseek to return something resembling an error code, because I get:

testing length 0xffffffff
large_file: lseek(fd, -1, 2) = -1 (ffffffffffffffff): No such file or directory

(The test passes now).


This change is Reviewable