[PATCH] fhandler_pipe: add sanity limit to handle loops

Ken Brown kbrown@cornell.edu
Sat Dec 25 22:18:05 GMT 2021

On 12/25/2021 2:20 PM, Jeremy Drake via Cygwin-patches wrote:
> On Sun, 26 Dec 2021, Takashi Yano wrote:
>> Could you please check the result of the following test case
>> in that ARM64 platform?
> I will probably not be able to get to this until tomorrow at the earliest.
> But keep in mind the issue I'm seeing is not deterministic - I have to run
> pacman in a loop validating files via GPGME and eventually it will hang
> (or hit the assert I added in that version).  Most of the time, it's
> perfectly fine.

The results you've already posted seem to indicate that, on your platform, 
NtQueryInformationProcess(ProcessHandleInformation) returns STATUS_SUCCESS even 
if the buffer it's passed is too small.  [That won't necessarily cause a problem 
in every one of your pacman runs, so it might appear non-deterministic.] 
Takashi's test case is designed to verify that that's what's going on.

And I think he also wants to see if phi->NumberOfHandles is reliable on your 
platform even when the buffer is too small.  If so, then (on your platform), the 
do-while loop could be replaced by two calls to NtQueryInformationProcess.  The 
first call would determine how big a buffer is needed, and the second call would 
use a buffer of that size.

But we don't know any of that for sure yet.  We also don't know (or at least I 
don't know) what aspects of your platform are relevant.  For example, does this 
always happen on Windows 11?  or on ARM64?


More information about the Cygwin-patches mailing list