[PATCH] fhandler_pipe: add sanity limit to handle loops

Ken Brown kbrown@cornell.edu
Thu Jan 13 14:39:23 GMT 2022


On 1/13/2022 5:56 AM, Takashi Yano wrote:
> Ken Brown wrote:
>> 2. You can use the ReturnLength parameter of NtQueryInformationProcess to see
>> how big a buffer is needed.  This might be more efficient than repeatedly
>> doubling the buffer size.
> 
> Even if ReturnLength is used, the first NtQueryInformationProcess()
> call and the second NtQueryInformationProcess() call will not be
> done in atomic, so retrying is still necessary. However, it may be
> more efficient as you mentioned.
> 
> The similar is true also for NtQuerySystemInformation().
> 
> Do you still think it is better to use ReturnLength rather than
> doubling the buffer?

I'm not sure.  I only mentioned it because I saw that that's what Process Hacker 
did, but still in a retry loop as you said.

I suspect it doesn't make a lot of difference in practice, since we call the 
function once and then cache the value.  Do whatever you think is best.

Thanks.

Ken


More information about the Cygwin mailing list