From: Jeremy Drake <cygwin@jdrake.com>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH] fhandler_pipe: add sanity limit to handle loops
Date: Thu, 23 Dec 2021 16:29:48 -0800 (PST) [thread overview]
Message-ID: <alpine.BSO.2.21.2112231623490.11760@resin.csoft.net> (raw)
In-Reply-To: <f97bba17-16ab-d7be-01f6-1c057fb5f1a5@cornell.edu>
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 less than
> phi->NumberOfHandles. Can you explain?
>
Not really. I saw this stack trace:
...
#3 0x0000000180062f13 in exception::handle (e=0x14cc4f0, frame=<optimized out>, in=<optimized out>, dispatch=<optimized out>) at /c/S/msys2-runtime/src/msys2-runtime/winsup/cygwin/exceptions.cc:835
#4 0x00007ff8abd320cf in ntdll!.chkstk () from /c/Windows/SYSTEM32/ntdll.dll
#5 0x00007ff8abce1454 in ntdll!RtlRaiseException () from /c/Windows/SYSTEM32/ntdll.dll
#6 0x00007ff8abd30bfe in ntdll!KiUserExceptionDispatcher () from /c/Windows/SYSTEM32/ntdll.dll
#7 0x0000000180092687 in fhandler_pipe::get_query_hdl_per_process (this=this@entry=0x1803700f8, name=name@entry=0x14cc820 L"\\Device\\NamedPipe\\dd50a72ab4668b33-10348-pipe-nt-0x6E6", ntfn=ntfn@entry=0x8000c2ce0) at /c/S/msys2-runtime/src/msys2-runtime/winsup/cygwin/fhandler_pipe.cc:1281
#8 0x0000000180092bdb in fhandler_pipe::temporary_query_hdl (this=this@entry=0x1803700f8) at /c/S/msys2-runtime/src/msys2-runtime/winsup/cygwin/fhandler_pipe.cc:1190
...
Line 1281 of fhandler_pipe.cc was
if (phi->Handles[j].GrantedAccess != access)
The only way I could see that causing an exception was if it was reading
past the end of the allocated memory, if j was greater than (or equal to)
n_handle. Unfortunately, I haven't been able to catch it in a debugger
again, so I can't confirm this. I took a core with 'dumper' but gdb
doesn't want to load it (it says Core file format not supported, maybe
something with msys2's gdb?).
next prev parent reply other threads:[~2021-12-24 0:29 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-23 23:10 Jeremy Drake
2021-12-24 0:06 ` Ken Brown
2021-12-24 0:29 ` Jeremy Drake [this message]
2021-12-24 17:17 ` Ken Brown
2021-12-24 19:42 ` Jeremy Drake
2021-12-24 22:46 ` Ken Brown
2021-12-24 23:42 ` Jeremy Drake
2021-12-25 0:39 ` Jeremy Drake
2021-12-25 3:19 ` Takashi Yano
2021-12-25 3:47 ` Jeremy Drake
2021-12-25 4:12 ` Takashi Yano
2021-12-25 5:40 ` Jeremy Drake
2021-12-25 17:10 ` Takashi Yano
2021-12-25 17:16 ` Takashi Yano
2021-12-25 19:00 ` Marco Atzeri
2021-12-25 19:20 ` Jeremy Drake
2021-12-25 22:18 ` Ken Brown
2021-12-25 23:00 ` Jeremy Drake
2021-12-26 3:04 ` Ken Brown
2021-12-26 4:56 ` Jeremy Drake
2021-12-26 15:09 ` Ken Brown
2021-12-26 16:04 ` Ken Brown
2021-12-26 16:24 ` Ken Brown
2021-12-26 21:35 ` Jeremy Drake
2021-12-26 22:18 ` Ken Brown
2021-12-26 22:43 ` Jeremy Drake
2021-12-26 23:12 ` Ken Brown
2021-12-26 23:23 ` Jeremy Drake
2021-12-27 2:42 ` Ken Brown
2021-12-27 21:12 ` Jeremy Drake
2021-12-29 21:59 ` Ken Brown
2021-12-29 23:29 ` Jeremy Drake
2021-12-27 20:01 ` Jon Turney
2021-12-29 5:45 ` Jeremy Drake
2021-12-30 15:44 ` Jon Turney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.BSO.2.21.2112231623490.11760@resin.csoft.net \
--to=cygwin@jdrake.com \
--cc=cygwin-patches@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).