From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH 3/3] Cygwin: Add loaded module base address list to stackdump
Date: Fri, 4 Nov 2022 11:34:14 +0100 [thread overview]
Message-ID: <Y2Tqpl1TuQc588N2@calimero.vinschen.de> (raw)
In-Reply-To: <d82f87ff-6708-b3bb-60f4-7f77ea47fd66@dronecode.org.uk>
On Nov 3 17:02, Jon Turney wrote:
> On 29/10/2022 09:32, Corinna Vinschen wrote:
> > On Oct 28 16:05, Jon Turney wrote:
> > > This adds an extra section to the stackdump, which lists the loaded
> > > modules and their base address. This is perhaps useful as it makes it
> > > immediately clear if RandomCrashInjectedDll.dll is loaded...
> > >
> > > XXX: It seems like the 'InMemoryOrder' part of 'InMemoryOrderModuleList' is a lie?
> >
> > Probably just an alternative fact...
>
> Yeah. I did stared a bit at the code wondering if the structure layouts
> were incorrect so we were somehow traversing one of the other module lists
> with a different ordering, but everything looks correct.
>
> The attached might be a good idea, then, to ensure that module+offset is
> calculated correctly.
Good idea, please push.
Corinna
> From ea47826047e8bb175b1b0e0286d7d7b8cf15c7fe Mon Sep 17 00:00:00 2001
> From: Jon Turney <jon.turney@dronecode.org.uk>
> Date: Tue, 1 Nov 2022 14:01:08 +0000
> Subject: [PATCH] Cygwin: Handle out of order modules for module offsets in
> stackdump
>
> Improve address to module+offset conversion, to work correctly in the
> presence of out-of-order elements in InMemoryOrderModuleList.
>
> Fixes: d59651d4
> ---
> winsup/cygwin/exceptions.cc | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
> index 8cc454c90..c3433ab94 100644
> --- a/winsup/cygwin/exceptions.cc
> +++ b/winsup/cygwin/exceptions.cc
> @@ -342,11 +342,13 @@ prettyprint_va (PVOID func_va)
> {
> PLDR_DATA_TABLE_ENTRY mod = CONTAINING_RECORD (x, LDR_DATA_TABLE_ENTRY,
> InMemoryOrderLinks);
> - if (mod->DllBase > func_va)
> + if ((func_va < mod->DllBase) ||
> + (func_va > (PVOID)((DWORD_PTR)mod->DllBase + mod->SizeOfImage)))
> continue;
>
> __small_sprintf (buf, "%S+0x%x", &mod->BaseDllName,
> (DWORD_PTR)func_va - (DWORD_PTR)mod->DllBase);
> + break;
> }
>
> return buf;
> --
> 2.38.1
>
next prev parent reply other threads:[~2022-11-04 11:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 15:05 [PATCH 0/3] Stackdump improvements Jon Turney
2022-10-28 15:05 ` [PATCH 1/3] Cygwin: Tidy up formatting of stackdump Jon Turney
2022-10-28 15:05 ` [PATCH 2/3] Cygwin: Add addresses as module offsets in .stackdump file Jon Turney
2022-10-28 15:05 ` [PATCH 3/3] Cygwin: Add loaded module base address list to stackdump Jon Turney
2022-10-29 8:32 ` Corinna Vinschen
2022-11-03 17:02 ` Jon Turney
2022-11-04 10:34 ` Corinna Vinschen [this message]
2022-10-29 8:34 ` [PATCH 0/3] Stackdump improvements Corinna Vinschen
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=Y2Tqpl1TuQc588N2@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.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).