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

lib/vfscore: Fix wrong application of umask #990

Closed
wants to merge 1 commit into from

Conversation

andreittr
Copy link
Contributor

Description of changes

Previously vfscore would apply the umask to the mode bits in the emulated libc functions open and openat, instead of within the open/openat syscall implementation where it would be correct to do so. This lead to the umask being ignored when a real libc was in use. This change fixes this bug, restoring expected behavior with or without a libc.

Prerequisite checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Ran the checkpatch.uk on your commit series before opening this PR;
  • Updated relevant documentation.

Base target

  • Architecture(s): N/A
  • Platform(s): N/A
  • Application(s): N/A

Additional configuration

Test with:

umask(0027);
f = open("file", O_WRONLY|O_CREAT, 0775);
fstat(f, &st);
printf("Should be: %o, is %o\n", 0775 & (~0027), st.st_mode);

@andreittr andreittr requested a review from a team as a code owner July 24, 2023 20:54
@razvand razvand self-assigned this Jul 25, 2023
@razvand razvand added area/lib Internal Unikraft Microlibrary kind/quick-fix Issue is a quick fix lib/vfscore VFS Core Interface lang/c Issues or PRs to do with C/C++ labels Jul 25, 2023
@razvand razvand added this to the v0.14.0 (Prometheus) milestone Jul 25, 2023
Copy link
Contributor

@RaduNichita RaduNichita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good from my side. Thanks @andreittr!

Reviewed-by: Radu Nichita radunichita99@gmail.com

@razvand razvand removed the request for review from a team August 5, 2023 05:35
Copy link
Member

@eduardvintila eduardvintila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, thanks.

Reviewed-by: Eduard Vintilă eduard.vintila47@gmail.com

Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved-by: Razvan Deaconescu razvand@unikraft.io

Previously vfscore would apply the umask to the mode bits in the
emulated libc functions `open` and `openat`, instead of within the
open/openat syscall implementation where it would be correct to do so.
This lead to the umask being ignored when a real libc was in use.
This change fixes this bug, restoring expected behavior with or without
a libc.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
@unikraft-bot
Copy link
Member

Checkpatch passed

Beep boop! I ran Unikraft's checkpatch.pl support script on your pull request and it all looks good!

SHA commit checkpatch
75f42ed lib/vfscore: Fix wrong application of umask

@andreittr andreittr deleted the ttr/vfs-umask branch August 7, 2023 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lib Internal Unikraft Microlibrary ci/merged Merged by CI kind/quick-fix Issue is a quick fix lang/c Issues or PRs to do with C/C++ lib/vfscore VFS Core Interface
Projects
Status: Done!
Development

Successfully merging this pull request may close these issues.

None yet

5 participants