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

RHBZ#2112559: VirtIO-FS: align group rights to owner rights #810

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
RHBZ#2112559: VirtIO-FS: align group rights to owner rights
In e3e722c both owner and group on guest side were set to Everyone.
But when converting POSIX mode to Windows security descriptor WinFSP
can restrict owner's rights to group's rights if owner's rights are
more permissive. Thereby, some previosly working configurations (e.g.
shared directory with 0700 rights) were broken. So, evelate group
rights when converting to security descriptor.

Signed-off-by: Viktor Prutyanov <viktor@daynix.com>
  • Loading branch information
viktor-prutyanov committed Aug 14, 2022
commit a1f9fea1f38eb90ae9475e2592680018ea609b08
5 changes: 3 additions & 2 deletions viofs/svc/virtiofs.cpp
Expand Up @@ -80,6 +80,7 @@
#define SafeHeapFree(p) if (p != NULL) { HeapFree(GetProcessHeap(), 0, p); }

#define ReadAndExecute(x) ((x) | (((x) & 0444) >> 2))
#define GroupAsOwner(x) (((x) & ~0070) | (((x) & 0700) >> 3))

typedef struct
{
Expand Down Expand Up @@ -1130,7 +1131,7 @@ static NTSTATUS GetFileInfoInternal(VIRTFS *VirtFs,
{
Status = FspPosixMapPermissionsToSecurityDescriptor(
VirtFs->LocalUid, VirtFs->LocalGid,
ReadAndExecute(attr->mode), SecurityDescriptor);
GroupAsOwner(ReadAndExecute(attr->mode)), SecurityDescriptor);
}
}

Expand Down Expand Up @@ -1306,7 +1307,7 @@ static NTSTATUS GetSecurityByName(FSP_FILE_SYSTEM *FileSystem, PWSTR FileName,
}

Status = FspPosixMapPermissionsToSecurityDescriptor(VirtFs->LocalUid,
VirtFs->LocalGid, ReadAndExecute(attr->mode), &Security);
VirtFs->LocalGid, GroupAsOwner(ReadAndExecute(attr->mode)), &Security);

if (NT_SUCCESS(Status))
{
Expand Down