Message ID | 20231204165029.408-1-ssbssa@yahoo.de |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 107E4384F9A5 for <patchwork@sourceware.org>; Mon, 4 Dec 2023 16:50:57 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from sonic311-31.consmr.mail.ir2.yahoo.com (sonic311-31.consmr.mail.ir2.yahoo.com [77.238.176.163]) by sourceware.org (Postfix) with ESMTPS id 74129385829B for <gdb-patches@sourceware.org>; Mon, 4 Dec 2023 16:50:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74129385829B Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=yahoo.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yahoo.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 74129385829B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=77.238.176.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701708645; cv=none; b=sRqvTpcmv7XPKCOeSkDiQUOvJxByQDVLVmmbnu0xtc/XfgvEzQLqaXGIJFKh1Y/zpVfT98U4w5S6Dg2xeaSqsb/k/D0e3CFH2nWCpfCdfgL0CTf8z5f7KHK5z7Xrckq6o+taBd9AGn9vXQBYCsfPqJfcMpc8OCGaP/G4jQ60vLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701708645; c=relaxed/simple; bh=8sb6xRKWx+Q/TyuHA+QA9uOBF46hgJsm9YPamdkdfvw=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=RJvAJo6taKJ3zHyJk2dDzJVvSTeizDGTWkllNgOl9KrQ0f4PA3GYskFrOX5YK+A5RUGnsJCA8RgK4UnVYZH/zr2WOeBJFqsXDpVOp9QuRq5auEYudsKzs1CAaCDj/ML8oO/kh0HilD6/8KcCzGqS/6qOnNHdCJU43tmz56vGxZI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1701708642; bh=esXmfJCASmgtk7+1LAUk00f7eCBcLEJ1DnSmQjfpJCI=; h=From:To:Subject:Date:References:From:Subject:Reply-To; b=sG4ubokNbP0f1Xe+uq/OV3CQtqIxdG/hLVON2254bXMCBRV6YwyuyfW68Adlo74Jok2V5dVxYJAozhNfzIRxL+iMiP8DHDlrMpNhNT14lI5hxF7i7boDyeMa6pahQorDVrpqWJAmAk8UzPkD1/JtkEjxRWzThJWfryVWtrLrxzhRfoxlaMYkPAdIQ13Bltt68I6Nojs8kPPO23+EN2ZtLYuNSLwkwBZd4EteLxCiPrbbNcd7wgVOU4e5F0LA+qDi59DhzbasPe/VxTp1cAe0ALPwCbd84V/jYZJjjOkFL9nsvrZLFD/vuwFjcBK5oYw39+LV7Xm2nCQ1GPGryhsZDg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1701708642; bh=YwDx7p5D5oFbC1pKI0nynlq8KCRMYwj0rX2KacZQS/F=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=cOeZqBOtUbYsldHBiG32//M9tIgwcoWQskXdoNJzSjDAwI3Cf/NnVGKXH66Q9wlB1KzInvGdlYE+Yj85ICwYwbICoZdTbQYV+kLA4oFVoRzRwavsj+xFpB8IWy/9h6OaU7NCO+hnx2ueoch2pou3gN4uH2vLNiNOXOEQt22W2KgSWTzT9wM3gerVeERbDZsNtrbfNy4zS2RhTdg+3PWp3lUCLBIljr4eHeIvLBYMBoswl4WR57+tl336FonTcaVlRamRdKFbwk6uGIrHOaipoPMVpVfcQ9exDVXd4mFS0xINai0j7h0HHjkzgrgTNxq9u4W8R+ZGMtbPK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78QnygE2zWIht4SKOD0_LUVf2Ps6NBhhpjVGRIF8d0kcUEtC4e6eeyhf9.L M6zIft_3aPHZnJXvLIU6DX9N_tj1omn7zpghI7P3DqcvkxLIpqBe0fx1Dgsvc6INY7SU7bOpoKE1 a59rKAwjTjpZv.SnG6G4GgCaZcTNq X-Sonic-MF: <ssbssa@yahoo.de> X-Sonic-ID: ffe4da24-f703-438b-a493-54bef8febe0f Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ir2.yahoo.com with HTTP; Mon, 4 Dec 2023 16:50:42 +0000 Received: by hermes--production-ir2-864cfb66d6-ngtsr (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 28be5737b024cfec94d3656666efc5f2; Mon, 04 Dec 2023 16:50:41 +0000 (UTC) From: Hannes Domani <ssbssa@yahoo.de> To: gdb-patches@sourceware.org Subject: [PATCH] Fix DLL export forwarding Date: Mon, 4 Dec 2023 17:50:29 +0100 Message-Id: <20231204165029.408-1-ssbssa@yahoo.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Antivirus: Avast (VPS 231204-0, 12/04/2023), Outbound message X-Antivirus-Status: Clean References: <20231204165029.408-1-ssbssa.ref@yahoo.de> X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org |
Series |
Fix DLL export forwarding
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_build--master-arm | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_check--master-arm | success | Testing passed |
Commit Message
Hannes Domani
Dec. 4, 2023, 4:50 p.m. UTC
I noticed it when I was trying to set a breakpoint at ExitProcess: ``` (gdb) b ExitProcess Breakpoint 1 at 0x14001fdd0 (gdb) r Starting program: C:\qiewer\heob\heob64.exe Warning: Cannot insert breakpoint 1. Cannot access memory at address 0x3dbf4120 Cannot insert breakpoint 1. Cannot access memory at address 0x77644120 ``` The problem doesn't exist in gdb 13.2, and the difference can easily be seen when printing ExitProcess. gdb 14.1: ``` (gdb) p ExitProcess $1 = {<text variable, no debug info>} 0x77644120 <UserHandleGrantAccess+36128> ``` gdb 13.2: ``` (gdb) p ExitProcess $1 = {<text variable, no debug info>} 0x77734120 <ntdll!RtlExitUserProcess> ``` The new behavior started with 9675da25357c7a3f472731ddc6eb3becc65b469a, where VMA was then calculated relative to FORWARD_DLL_NAME, while it was relative to DLL_NAME before. Fixed by calculating VMA relative to DLL_NAME again. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31112 --- gdb/coff-pe-read.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Comments
Hi Hannes, I am not familiar with this part of the code so I'll let someone else comment on the actual change, but found a minor typo. Other than this, and FWIW, the change seem reasonable to me. On Mon, Dec 04, 2023 at 05:50:29PM +0100, Hannes Domani wrote: > I noticed it when I was trying to set a breakpoint at ExitProcess: > ``` > (gdb) b ExitProcess > Breakpoint 1 at 0x14001fdd0 > (gdb) r > Starting program: C:\qiewer\heob\heob64.exe > Warning: > Cannot insert breakpoint 1. > Cannot access memory at address 0x3dbf4120 > Cannot insert breakpoint 1. > Cannot access memory at address 0x77644120 > ``` > > The problem doesn't exist in gdb 13.2, and the difference can easily be > seen when printing ExitProcess. > gdb 14.1: > ``` > (gdb) p ExitProcess > $1 = {<text variable, no debug info>} 0x77644120 <UserHandleGrantAccess+36128> > ``` > gdb 13.2: > ``` > (gdb) p ExitProcess > $1 = {<text variable, no debug info>} 0x77734120 <ntdll!RtlExitUserProcess> > ``` > > The new behavior started with 9675da25357c7a3f472731ddc6eb3becc65b469a, > where VMA was then calculated relative to FORWARD_DLL_NAME, while it was > relative to DLL_NAME before. > > Fixed by calculating VMA relative to DLL_NAME again. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31112 > --- > gdb/coff-pe-read.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c > index 56137ac4dd0..c9d6d86a085 100644 > --- a/gdb/coff-pe-read.c > +++ b/gdb/coff-pe-read.c > @@ -210,7 +210,10 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader, > " \"%s\" in dll \"%s\", pointing to \"%s\"\n"), > sym_name, dll_name, forward_qualified_name.c_str ()); > > - unrelocated_addr vma = msymbol.minsym->unrelocated_address (); > + /* Calculate VMA as if if where relative to DLL_NAME/OBJFILE, even though ^ s/if if/if it/ > + it actually points inside another dll (FORWARD_DLL_NAME). */ > + unrelocated_addr vma = unrelocated_addr(msymbol.value_address () > + - objfile->text_section_offset ()); > msymtype = msymbol.minsym->type (); > section = msymbol.minsym->section_index (); > > -- > 2.35.1 > Best, Lancelot.
>>>>> "Hannes" == Hannes Domani <ssbssa@yahoo.de> writes:
Hannes> I noticed it when I was trying to set a breakpoint at ExitProcess:
...
Thank you for the patch.
I have a couple of tiny nits, this is ok with those fixed -- you don't
have to re-send it.
You can also apply this to the gdb-14 branch if you want.
Hannes> - unrelocated_addr vma = msymbol.minsym->unrelocated_address ();
Hannes> + /* Calculate VMA as if if where relative to DLL_NAME/OBJFILE, even though
s/if where/it were/
Hannes> + it actually points inside another dll (FORWARD_DLL_NAME). */
Hannes> + unrelocated_addr vma = unrelocated_addr(msymbol.value_address ()
Space before the first "(".
Approved-By: Tom Tromey <tom@tromey.com>
Tom
Am Mittwoch, 6. Dezember 2023, 20:31:20 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben: > >>>>> "Hannes" == Hannes Domani <ssbssa@yahoo.de> writes: > > Hannes> I noticed it when I was trying to set a breakpoint at ExitProcess: > ... > > Thank you for the patch. > > I have a couple of tiny nits, this is ok with those fixed -- you don't > have to re-send it. > > You can also apply this to the gdb-14 branch if you want. > > Hannes> - unrelocated_addr vma = msymbol.minsym->unrelocated_address (); > Hannes> + /* Calculate VMA as if if where relative to DLL_NAME/OBJFILE, even though > > s/if where/it were/ > > Hannes> + it actually points inside another dll (FORWARD_DLL_NAME). */ > Hannes> + unrelocated_addr vma = unrelocated_addr(msymbol.value_address () > > Space before the first "(". > > Approved-By: Tom Tromey <tom@tromey.com> Thank you both Lancelot and Tom for noticing my typos. They are fixed and it's pushed to both master and gdb-14-branch.
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c index 56137ac4dd0..c9d6d86a085 100644 --- a/gdb/coff-pe-read.c +++ b/gdb/coff-pe-read.c @@ -210,7 +210,10 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader, " \"%s\" in dll \"%s\", pointing to \"%s\"\n"), sym_name, dll_name, forward_qualified_name.c_str ()); - unrelocated_addr vma = msymbol.minsym->unrelocated_address (); + /* Calculate VMA as if if where relative to DLL_NAME/OBJFILE, even though + it actually points inside another dll (FORWARD_DLL_NAME). */ + unrelocated_addr vma = unrelocated_addr(msymbol.value_address () + - objfile->text_section_offset ()); msymtype = msymbol.minsym->type (); section = msymbol.minsym->section_index ();