DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 50DIN4tV2932617 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 50DIN4tV2932617 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=JmtNU5CR X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D4B72385782C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1736792583; bh=dnIDmWUzkCsDfx0LAD2O2WG3Ew7OsNCurbFzkntbGYw=; h=Date:To:cc:Subject:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=JmtNU5CRCS/FJDT9RKazhk7tUqJk4Nw1dq1nXiuEf/M/UaHYw662/W9SPTvLpKAkL BeHT80LnmJOzZcUrIib2gRG4sUFMDioeTmoYNY5a6PiovH5vIg8u45ke5fFMs5IYgh sEdhDr58diSJeQ5lZ+Ha3ey0pyuffr114rTXNR7E= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA57C3857B8C ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CA57C3857B8C ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736792524; cv=none; b=sLISvrzEN8LBYqn2ZbsFii9yeATT+Bw1BuT5GA0wl/jwsIk0HlbtXH7ReHAybot4H70nT0bPuuZ2Zh10cyVrlEhC3yizgCfkkoDX2Fyobg+MRcvm9RLhEOeJCioO9ChPiYDKgAhhewohi8Afqb4VXzkd+EklUD4/U5lFcOW9rss= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736792524; c=relaxed/simple; bh=FBlULK8dYkC/9yy526GybPu+/sVOUQBxCJPcqSvXZ10=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=bzgdiNanueLOS+UsqLpAB4WsMKuKYSMDtr0y7j4K53Ybz5NnkVsAlr+Bw1CCsAHxT2xgjs6MHDl8QSVeBf6DmvfxAq95K5s0TxStI64nFA4P7roWcqZ71GMO+BVPfw9jqyXB4lo4euGAYF/ntCdrlZNu6NqBwhXbg082yp/gm20= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA57C3857B8C X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Date: Mon, 13 Jan 2025 19:21:58 +0100 (CET) To: Veronica Giaudrone cc: "cygwin AT cygwin DOT com" , Whitney Schmidt , Sebastian Hernandez Subject: Re: [Bug check/report] UnDocumented call to ntdll.dll!NtAssignProcessToJobObject in msys2.0.dll / cygwin - included in mingit/Git for Windows In-Reply-To: Message-ID: <386331e7-9d9c-43fd-e437-3db0991c5258@gmx.de> References: MIME-Version: 1.0 X-Provags-ID: V03:K1:ZAhb+XLiNU2xP+EOTWJcnL8RWnnefhdesNDyhKRYi8fbwvsjcVJ JHKEu2Pp1JrwdfvAVmgHCzlPUwrAJhl82KIfpby02CpVLhIx9f+VPyrqM7SZ5Qcig2Ys0Ea gWGBb85eoLAbQjzd96gQQeSURXiMX/K6OSCg+USO+UZI2taCLSjqdSyqHyG08QJxH2G6yAz P993Bhug2q9nMUU1biN2w== UI-OutboundReport: notjunk:1;M01:P0:AH5Em64TIEg=;SwmfBtLKE1e2JGXcq79+eMtmEFT fHAKPZD6Uec6sTGVyCAQ7x9EIw9u+nPiK0vo6Klg7DfKSbOloXF4uHdBauBfib/TDqThIjJy2 sA5gZ/TmGhDufWdo1g0vyUKy8IHKJll4YPSWYgciaqqQQw8FLgMIG+K6t48dc+kjz3n4r0iOk 2/dxL9sjhmaezZcIxDvS6oPFjk9PDSAs8/8GexoNCO8Emux0WKc0BVkE8jMOb1nmSRQMmz5jX L4Zi4houA5G6+l4rx+4msF92RmiOcqsKd3NRuwiIycqQdULHHegKX2As7oXciQ+SaG8ml70PD 1TEAJoTx8TH6nwWMnyGo3hyAXs5xoSU0snrzUx181X63tLCDFnq56GuFiUauPW5kfNlfQ4aPz Zo133MmvIKrFFIfepP+yUtleuB9mkpdrYwrrlg3EZONNRLLxAidR3aAQIYAtLKaLb0qbYi3Rm 3aKIFOMJ8cre/e2wjUzH9CTATcEZ4rjF6wLUOcFzkdp3JUMvh7Nxpz+8+fBHf1whUU8wrAHyQ L+4rUTc7yrw8ywBVuEnJYy1cPNjjzLDoQzRNtXFLt1kEhGvGJRE8Bhx30doEc7ljHA60/l4Cc rmiZNcNg5yiKH2i/fezeisyc8PXqlo1tVqPTlEvQaYtHnWfzW5ca5ylzzsMn7XNxlFdgyPpIK bSWh7rD4HA5qiMFM/iYi6tjlHw9rjYBXE4MtL6t015X7AK1KSofpV4NGXemzPx7v0epgyLQ50 QimnXREqsVWU70KrL6NCnlfwrwpNmuUtyeZa9qK1t9llT25M8ujSmEfw7fKlFTMXn8RTkCoFt zYJoFhUCxMKVTJN8TrUy7YJeUctKy54B8l1NoW2wuWHdbWYC2gW+mvbY+UgkSMtzukLXpHXE7 Rn+LIg0q9V2zplfWR3Me+0cLew13MCjaNnC5dBPQhSyypc3a17Alh7g+xgavTuUmZAjFb/31o Zu2AvJK1pGQOgZzMo440qRQ6k6Aul8sAanO06CWD2r2Zons02b1dt2lUtEtVjVTFmID5hh+Fd 6B1GSjS0DQrucZCyI4gj3yh9Z67V1g1k/rbPxUKK8fH00QvjijvQLCiRw3V1dWg+ia1sJtu6n 6FwXZgh0CvWSGab9MOtposuuw4KziVrTAn2wYRZD/ooa4UHeg8cy2/sgu7JOgAhRAOaSTB75k = X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Johannes Schindelin via Cygwin Reply-To: Johannes Schindelin Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Hi Veronica & Cygwin list (please keep me Cc:ed, I am not subscribed), On Sat, 11 Jan 2025, Veronica Giaudrone wrote: > 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 > * 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, > 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 > > Are you aware of this undocumented API call or a reason to not attempt updating them to documented ones? > > The scan identified a few others like: > > * NtOpenJobObject > * NtCreateJobObject > * NtQueryInformationJobObject > * NtSetInformationJobObject These seem to have been introduced in the very same commit as `NtAssignProcessToJobObject()`. Seeing as the original code on oneBB did not require undocumented function calls, I could imagine that it might be an obvious and uncontroversial change to use documented functions. > * NtOpenMutant - we're not sure yet of the documented call for this one. There are multiple mentions of this (and of `NtCreateMutant()`, also an undocumented function) in Cygwin's source code, most notably in `winsup/cygwin/kernel32.cc`, where the `CreateMutexW()` and `OpenMutexW()` function are reimplemented, preceded with this informative comment: /* Implement CreateMutex/OpenMutex so that named objects are * always created in Cygwin shared object namespace. */ Specifically, if `NULL` was passed in as `lpName`, the code calls `InitializeObjectAttributes()` with `get_shared_parent_dir()` as root object directory. I am too unfamiliar with such internals to tell whether there is a way to accomplish this exclusively using documented functions. Ciao, Johannes -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple