mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-01-12 08:40:54 +00:00
p9: Fix file and directory creation mode
Don't allow clients to create files and directories that are writable by anyone other than the user. This is equivalent to having a umask of 022. BUG=chromium:703939 TEST=change the umask in the container, mkdir, and see that it has 0755 Change-Id: I0622fcd89935512969bcd25a9b1fece1e72e1f38 Signed-off-by: Chirantan Ekbote <chirantan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1112869 Reviewed-by: Dylan Reid <dgreid@chromium.org>
This commit is contained in:
parent
f2fb37e669
commit
d678784ae1
1 changed files with 2 additions and 2 deletions
|
@ -541,7 +541,7 @@ impl Server {
|
||||||
.append((lcreate.flags & P9_APPEND) != 0)
|
.append((lcreate.flags & P9_APPEND) != 0)
|
||||||
.create_new((lcreate.flags & P9_EXCL) != 0)
|
.create_new((lcreate.flags & P9_EXCL) != 0)
|
||||||
.custom_flags(custom_flags)
|
.custom_flags(custom_flags)
|
||||||
.mode(lcreate.mode & 0o777)
|
.mode(lcreate.mode & 0o755)
|
||||||
.open(&path)?;
|
.open(&path)?;
|
||||||
|
|
||||||
fid.metadata = file.metadata()?;
|
fid.metadata = file.metadata()?;
|
||||||
|
@ -842,7 +842,7 @@ impl Server {
|
||||||
|
|
||||||
fs::DirBuilder::new()
|
fs::DirBuilder::new()
|
||||||
.recursive(false)
|
.recursive(false)
|
||||||
.mode(mkdir.mode & 0o777)
|
.mode(mkdir.mode & 0o755)
|
||||||
.create(&newpath)?;
|
.create(&newpath)?;
|
||||||
|
|
||||||
Ok(Rmessage::Mkdir(Rmkdir {
|
Ok(Rmessage::Mkdir(Rmkdir {
|
||||||
|
|
Loading…
Reference in a new issue