Hello Cygwin developers, I’m part of the Visual Studio team at Microsoft which includes mingit/Git for Windows in our product for Git tooling integration (I’m copying a couple of folks from my team in this email too). One of our API scanning tools has identified msys2.0.dll calling undocumented Windows APIs like ntdll.dll!NtAssignProcessToJobObject:
* In cygwin - https://github.com/search?q=repo%3Acygwin%2Fcygwin+NtAssignProcessToJobObject&type=code with a caller: cygwin/winsup/cygwin/resource.cc at 21a2c9db6952954608cdf92638b411b15e7606c6 · cygwin/cygwin<https://github.com/cygwin/cygwin/blob/21a2c9db6952954608cdf92638b411b15e7606c6/winsup/cygwin/resource.cc#L246> * Looks like it was introduced ~3 years ago: https://github.com/cygwin/cygwin/commit/1c7384f9d1b692c8b58af4db8c81d2ce0b10ad06#diff-bc84d57ac99958a694cb56b977bac1360e35040f9aa421972702219e11055ae8R290 * The code indicates to have come from oneTBB/test/tbbmalloc/test_malloc_compliance.cpp at bd291eb0d1c7f802ca5081a8755562ab786db2a2 · uxlfoundation/oneTBB<https://github.com/uxlfoundation/oneTBB/blob/bd291eb0d1c7f802ca5081a8755562ab786db2a2/test/tbbmalloc/test_malloc_compliance.cpp#L56-L78>, though in that case the usage is of the documented API instead. We believe the above call should get replaced by the following documented API - AssignProcessToJobObject function (jobapi2.h) - Win32 apps | Microsoft Learn<https://learn.microsoft.com/en-us/windows/win32/api/jobapi2/nf-jobapi2-assignprocesstojobobject> The scan also identified the following undocumented API calls, which were introduced in the same commit<https://github.com/cygwin/cygwin/commit/1c7384f9d1b692c8b58af4db8c81d2ce0b10ad06#diff-bc84d57ac99958a694cb56b977bac1360e35040f9aa421972702219e11055ae8R290>. We also believe that the below calls should be replaced with the corresponding documented APIs: * NtOpenJobObject - OpenJobObjectA<https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-openjobobjecta> * NtCreateJobObject - CreateJobObjectA<https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createjobobjecta> * NtQueryInformationJobObject - QueryInformationJobObject<https://learn.microsoft.com/en-us/windows/win32/api/jobapi2/nf-jobapi2-queryinformationjobobject> * NtSetInformationJobObject - SetInformationJobObject<https://learn.microsoft.com/en-us/windows/win32/api/jobapi2/nf-jobapi2-setinformationjobobject> * NTAssignProcessToJobObject - AssignProcessToJobObject<https://learn.microsoft.com/en-us/windows/win32/api/jobapi2/nf-jobapi2-assignprocesstojobobject> Are you aware of this undocumented API call or a reason to not attempt updating them to documented ones? We would appreciate any thoughts/feedback. Our team has put together a patch that updates the undocumented APIs to the documented versions, which is attached to this email as well as sent to cygwin-patches. Thanks, Whitney & Sebastian
0001-replace-undocumented-Nt-calls-with-documented-win32- 1.patch
Description: 0001-replace-undocumented-Nt-calls-with-documented-win32- 1.patch