Re: [PATCH] fhandler_pipe: add sanity limit to handle loops

2021-12-24 Thread Jeremy Drake via Cygwin-patches
On Sat, 25 Dec 2021, Takashi Yano wrote: > On Fri, 24 Dec 2021 19:47:46 -0800 (PST) > Jeremy Drake wrote: > > phi->NumberOfHandles = 7999168, n_handle = 256 > > assertion "phi->NumberOfHandles <= n_handle" failed: file > > "../../.././winsup/cygwin/fhandler_pipe.cc", line 1280, function: void* >

Re: [PATCH] fhandler_pipe: add sanity limit to handle loops

2021-12-24 Thread Takashi Yano
On Fri, 24 Dec 2021 19:47:46 -0800 (PST) Jeremy Drake wrote: > phi->NumberOfHandles = 7999168, n_handle = 256 > assertion "phi->NumberOfHandles <= n_handle" failed: file > "../../.././winsup/cygwin/fhandler_pipe.cc", line 1280, function: void* > fhandler_pipe::get_query_hdl_per_process(WCHAR*,

Re: [PATCH] fhandler_pipe: add sanity limit to handle loops

2021-12-24 Thread Jeremy Drake via Cygwin-patches
On Sat, 25 Dec 2021, Takashi Yano wrote: > Could you please try > assert(phi->NumberOfHandles <= n_handle) > rather than > assert(phi->NumberOfHandles < n_handle) > ? I thought of that when I was re-reading my email. I also added a printf: index 9ce140089..4d10451c1 100644 ---

Re: [PATCH] fhandler_pipe: add sanity limit to handle loops

2021-12-24 Thread Takashi Yano
On Fri, 24 Dec 2021 16:39:13 -0800 (PST) Jeremy Drake wrote: > On Fri, 24 Dec 2021, Ken Brown wrote: > > > On 12/24/2021 2:42 PM, Jeremy Drake wrote: > > > It does seem to happen much more often on Windows on ARM64 (so much so > > > that at first I thought it was an issue with their emulation).

Re: [PATCH] fhandler_pipe: add sanity limit to handle loops

2021-12-24 Thread Jeremy Drake via Cygwin-patches
On Fri, 24 Dec 2021, Ken Brown wrote: > On 12/24/2021 2:42 PM, Jeremy Drake wrote: > > It does seem to happen much more often on Windows on ARM64 (so much so > > that at first I thought it was an issue with their emulation). With this > > patch I have not seen the issue again. > > So can you

Re: [PATCH] fhandler_pipe: add sanity limit to handle loops

2021-12-24 Thread Jeremy Drake via Cygwin-patches
On Fri, 24 Dec 2021, Ken Brown wrote: > So can you test your diagnosis by removing your patch and adding an assertion? I will attempt to do this. Do I need any special configure args or anything for assertions to be enabled? > > Also, it seems to have started cropping up in msys2's CI when the

Re: [PATCH] fhandler_pipe: add sanity limit to handle loops

2021-12-24 Thread Ken Brown
On 12/24/2021 2:42 PM, Jeremy Drake wrote: On Fri, 24 Dec 2021, Ken Brown wrote: I agree that it's hard to see how the line you quoted could cause an exception. But you were using an optimized build, so I'm not sure how reliable the line-number information is. Is it feasible to run your test

Re: [PATCH] fhandler_pipe: add sanity limit to handle loops

2021-12-24 Thread Jeremy Drake via Cygwin-patches
On Fri, 24 Dec 2021, Ken Brown wrote: > I agree that it's hard to see how the line you quoted could cause an > exception. But you were using an optimized build, so I'm not sure how > reliable the line-number information is. > > Is it feasible to run your test under strace? If so, you could add

Re: [PATCH] fhandler_pipe: add sanity limit to handle loops

2021-12-24 Thread Ken Brown
On 12/23/2021 7:29 PM, Jeremy Drake via Cygwin-patches wrote: On Thu, 23 Dec 2021, Ken Brown wrote: - for (ULONG j = 0; j < phi->NumberOfHandles; j++) + for (ULONG j = 0; j < min(phi->NumberOfHandles, n_handle); j++) Reading the preceding code, I don't see how n_handle could be