Skip to content
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

statvfs fails to create a file with max filename length #1756

Open
anjalirai-intel opened this issue Feb 6, 2024 · 3 comments
Open

statvfs fails to create a file with max filename length #1756

anjalirai-intel opened this issue Feb 6, 2024 · 3 comments

Comments

@anjalirai-intel
Copy link
Contributor

Description of the problem

statvfs01 has 3 sub-test, out of which 2 are passed, and 1 failed i.e. 2nd sub-test

The test tries to create a file with Max length of filename (255), and it fails with EACCESS error

We also tried to create the file with different filename length, By specifying the filename length as 251, gramine is able to create the file and it does not throw the error, but if you try to create with filename length from 252 till 255 then gramine is failing with EACCESS error

Scenario 1:

valid_len is 251
TPASS: creat(valid_fname, 0444) returned fd 4

Scenario 2:

valid_len is 252
TFAIL: creat(valid_fname, 0444) failed: EACCES (13)

Scenario 3:

valid_len is 255
TFAIL: creat(valid_fname, 0444) failed: EACCES (13)

Steps to reproduce

Compile the attached test file and run with gramine-direct/gramine-sgx
statvfs01.zip

Expected results

with valid_len as 255 the test should pass
TPASS: creat(valid_fname, 0444) returned fd 4

Actual results

TFAIL: creat(valid_fname, 0444) failed: EACCES (13)

Gramine commit hash

1cf1f46

@dimakuv
Copy link

dimakuv commented Feb 6, 2024

I confirm that this is a real bug. We didn't investigate yet why Gramine fails with EACCES on files with name length of 252 (I guess it has to do with file: prefix for the PAL layer).

Technically Gramine has support for ENAMETOOLONG, but it looks like these corner cases are never triggered, because Gramine code fails somewhere before those checks.

@mkow
Copy link
Member

mkow commented May 6, 2024

I cannot reproduce this issue, statvfs01 passes for me and also in CI, as it's not blacklisted in ltp.cfg.

@dimakuv
Copy link

dimakuv commented May 6, 2024

That's probably the same situation as with #1757

We have https://github.com/linux-test-project/ltp/tree/da2f34028f046a208aa2fed5e287df2538e69f91 (version LTP 20200930).

I assume that smth changed in statvfs01 in LTP 20210927 or later.

So @anjalirai-intel was enabling this newer version of LTP (I think), and hit this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants