-
Notifications
You must be signed in to change notification settings - Fork 18k
syscall: use Windows FILE_FLAG_BACKUP_SEMANTICS in remaining places (Open) #23312
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
Comments
/cc @alexbrainman |
We only use FILE_FLAG_BACKUP_SEMANTICS to open directories and symlinks. There is no way to open them without FILE_FLAG_BACKUP_SEMANTICS flag. We do not use FILE_FLAG_BACKUP_SEMANTICS to open files, because everything we do with files work just fine without FILE_FLAG_BACKUP_SEMANTICS.
Why? What is broken if we don't do that?
I did not understand this explanation. Please try again. Thank you. Alex |
A backup program should be able to back up all files on the system. But, a backup program must run as a certain Windows user, and it's possible that there are some files that the backup user account does not have permission to access, according to the normal ACL permission system. Windows has a solution for it: You can open a file if either (A) you have normal ACL permissions to do so, or (B) your user account has Passing this flag does not change behaviour in the normal case. It only increases the functionality. So, I don't think there's any harm in passing this flag unconditionally.
Right now, it's difficult to write backup programs in Go that take advantage of |
Thank for explaining.
I am not security expert, so I would not know if there is a downside to
You can call syscall.CreateFile directly. Not many people write backup programs, so people who do, would have to jump through the hoops that Microsoft creates. Sorry. Alex |
I made some experiments with patching |
Unconditionally setting
I'm interested in setting |
There is another alternative to always setting We could then export this constat in x/sys/windows as |
Hi,
FILE_FLAG_BACKUP_SEMANTICS
is an optional flag to the WindowsCreateFile
API. It allows accessing files when privilege would be denied by normal Windows ACLs, except for that the user account has theSE_BACKUP_NAME
privilege. If the calling user account does not have this privilege, adding this flag has no impact to behaviour nor performance.Go already uses
FILE_FLAG_BACKUP_SEMANTICS
in some CreateFile calls (e.g.Readlink
,Utimes
,UtimesNano
, from issues #8090 and #10804) but not in other cases (notablyOpen
). So it's inconsistent.I would like to request that
FILE_FLAG_BACKUP_SEMANTICS
is added to theOpen
call insrc/syscall/syscall_windows.go
.As well as fixing the inconsistency, this would allow Go users to open files on disk, in those cases where their permission to do so comes via
SE_BACKUP_NAME
instead of windows ACLs.Thanks
mappu
More information:
What version of Go are you using (
go version
)?go version go1.9.2 windows/amd64
Does this issue reproduce with the latest release?
Yes
The text was updated successfully, but these errors were encountered: