-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
MinGW: link as terminal server aware #3942
Conversation
Whith Windows 2000, Microsoft introduced a flag to the PE header to mark executables as "terminal server aware". Windows terminal servers provide a redirected Windows directory and redirected registry hives when launching legacy applications without this flag set. Since we do not use any INI files in the Windows directory and don't write to the registry, we don't need this additional preparation. Telling the OS that we don't need this should provide slightly improved startup times in terminal server environments. When building for supported Windows Versions with MSVC the /TSAWARE linker flag is automatically set, but MinGW requires us to set the --tsaware flag manually. This partially addresses git-for-windows#3935. Signed-off-by: Matthias Aßhauer <[email protected]>
@rimrul thank you for providing this PR. I have to admit that I am not really knowledgeable of the full extent of the impact of this |
FWIW I kicked off a |
@ElemenTP since you seem to have access to Windows Terminal Services, could you give this a good testing? I am really unsure of the risk, and that would give me some confidence. |
There is some documentation, but it's not much. https://docs.microsoft.com/en-us/previous-versions/aa382957 The older versions of the first document are a little more detailed on when MSVC does it by default: I've also found this stackoverflow discussion noticing that it leads to a separate The flag should be set for all cygwin executables, so I'm slightly confused why the original report mentions executables in |
We could ping the documentation author and kindly ask them about this. They're fairly active on GitHub and might be able to tell us (and/or document) all the things that happen with/without this flag. |
Thank you for your attention.
I have tested the installer git in |
I tested this for both mingw-gcc with linker version 2.38 and MSVC with linker version 14.32, the artifacts with or without tsaware flag are of the same number of sections.
|
Quoting from there:
Wouldn't this be something we want, to safe-guard Git users from other (potentially malicious) users on the same Terminal Services server? |
Do we read any config from or write any config to the windows directory? |
Not that I am aware of, other than the registry entry to determine whether we're running in a container. But I am worried about things I might have missed. For example, for years I did not realize that |
I do not think this flag is a security feature. If an attacker can write malicious payloads into the system's Windows directory, there is no need to exploit Git through some kind of DLL planting -- they already have administrative access. Nearly every app compiled with a 21st century toolchain has this flag set by default -- Microsoft seems to think that there's very little risk. |
I guess you're right ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I made up my mind, thank y'all for your patience convincing me!
Git's executables are [now](#429) marked [Terminal Server-aware](git-for-windows/git#3942), meaning: Git will be slightly faster when being run using Remote Desktop Services. Signed-off-by: Johannes Schindelin <[email protected]>
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
MinGW: link as terminal server aware
Whith Windows 2000, Microsoft introduced a flag to the PE header to mark executables as
"terminal server aware". Windows terminal servers provide a redirected Windows directory and
redirected registry hives when launching legacy applications without this flag set. Since we
do not use any INI files in the Windows directory and don't write to the registry, we don't
need this additional preparation. Telling the OS that we don't need this should provide
slightly improved startup times in terminal server environments.
When building for supported Windows Versions with MSVC the /TSAWARE linker flag is
automatically set, but MinGW requires us to set the --tsaware flag manually.
This partially addresses #3935