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

Extra zeros at the end of files with FUSE #1111

Closed
mkroening opened this issue Mar 26, 2024 · 1 comment · Fixed by #1113
Closed

Extra zeros at the end of files with FUSE #1111

mkroening opened this issue Mar 26, 2024 · 1 comment · Fixed by #1113
Assignees

Comments

@mkroening
Copy link
Member

mkroening commented Mar 26, 2024

This program

fn main() {
    std::fs::write("/root/test.txt", "important content").unwrap();
}

writes extra zeros to the end of the file:

$ od -t x1 foo/test.txt 
0000000 69 6d 70 6f 72 74 61 6e 74 20 63 6f 6e 74 65 6e
0000020 74 00 00 00 00 00 00 00
0000030

expected:

$ od -t x1 foo/test.txt 
0000000 69 6d 70 6f 72 74 61 6e 74 20 63 6f 6e 74 65 6e
0000020 74
0000021

Bisecting fails since not all of #1047 's commits compile!

There are only 'skip'ped commits left to test.
The first bad commit could be any of:
a2212c010250c69ce581a9459683ae14a7b963ef
fbb5789508286aa5a019f8b9e5371c3ecbf108d2
24c425b5e825ca5e2c91bdd863df9b5cdf33717f
3a93d4a843fa9e9af340ff4432f461265d90f508
f13bf48f06817a2a44f5dc903f4cd8ac8163fe2a
We cannot bisect more!

This can be replicated by editing hello_world in hermit-rs and running

cargo xtask ci qemu --arch x86_64 --profile dev --package hello_world --virtiofsd

CC: @cagatay-y

@mkroening mkroening changed the title Corrupt file contents with FUSE Extra zeros at the end of files with FUSE Mar 26, 2024
@cagatay-y
Copy link
Contributor

I think we were not testing FUSE except for initialization. When I set the log level for virtiofsd to trace and ran the rusty_demo test, I got no trace output and no file was created in the shared directory. However, when I changed the path provided in the test from "/tmp/foo.txt" to "/root/foo.txt" in rusty_demo ("/root" is the mount point logged during the initialization), I got log output for file creation, a file in the shared directory and a crash during the file read.

Also, it seems like the test is broken for the release build and the driver cannot be initialized. This is not the case with the debug build. We probably did not notice that because FUSE was bypassed.

cagatay-y added a commit to cagatay-y/kernel that referenced this issue Mar 26, 2024
cagatay-y added a commit to cagatay-y/kernel that referenced this issue Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants