From f14b7db25a2b6826077cd1e821f59d4d540f31c7 Mon Sep 17 00:00:00 2001
From: ghidra1
Date: Thu, 6 Jun 2024 16:26:04 -0400
Subject: [PATCH 1/4] GP-0 Additional WhatsNew HTML formatting corrections
---
.../Public_Release/src/global/docs/WhatsNew.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Ghidra/Configurations/Public_Release/src/global/docs/WhatsNew.html b/Ghidra/Configurations/Public_Release/src/global/docs/WhatsNew.html
index cae9280a10..d6ea3ae12f 100644
--- a/Ghidra/Configurations/Public_Release/src/global/docs/WhatsNew.html
+++ b/Ghidra/Configurations/Public_Release/src/global/docs/WhatsNew.html
@@ -170,8 +170,8 @@
Standard keyboard navigation should now work in most component windows and dialogs. In general, Tab and <CTRL> Tab will
move focus to the next focusable component and <SHIFT> Tab and <CTRL><SHIFT> Tab will move to the
previous focusable component. Tab and <SHIFT> Tab do not always work as some components use those keys internally, but
- <CTRL> Tab, and <SHIFT><CTRL> Tab should work universally.
- Ghidra now provides some convenient keyboard shortcut actions for transferring focus:
+ <CTRL> Tab, and <SHIFT><CTRL> Tab should work universally.
+ Ghidra now provides some convenient keyboard shortcut actions for transferring focus:
- <CTRL> F3 - Transfers focus to the next window or dialog.
- <CTRL><SHIFT> F3 - Transfers focus to the previous window or dialog.
From ad5975fdc295440c0da42c000f030d14068451a5 Mon Sep 17 00:00:00 2001
From: ghidra1
Date: Thu, 6 Jun 2024 16:52:09 -0400
Subject: [PATCH 2/4] GP-0 Additional WhatsNew edits
---
.../Public_Release/src/global/docs/WhatsNew.html | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Ghidra/Configurations/Public_Release/src/global/docs/WhatsNew.html b/Ghidra/Configurations/Public_Release/src/global/docs/WhatsNew.html
index d6ea3ae12f..54f9d2b9af 100644
--- a/Ghidra/Configurations/Public_Release/src/global/docs/WhatsNew.html
+++ b/Ghidra/Configurations/Public_Release/src/global/docs/WhatsNew.html
@@ -60,7 +60,10 @@
NOTE: Each build distribution will include native components (e.g., decompiler) for at least one platform (e.g., Windows x86-64).
If you have another platform that is not included in the build distribution, you can build
native components for your platform directly from the distribution.
- See the Ghidra Installation Guide for additional information.
+ See the Ghidra Installation Guide for additional information.
+ Users running with older shared libraries and operating systems (e.g., CentOS 7.x) may also run into
+ compatibility errors when launching native executables such as the Decompiler and GNU Demangler which
+ may necessitate a rebuild of native components.
IMPORTANT: To use the Debugger, you will need Python3 (3.7 to 3.12 supported) installed on your system.
From b1a67cce480e2223b0d6e2472f82d6c8a9bb6e48 Mon Sep 17 00:00:00 2001
From: ghidra1
Date: Tue, 4 Jun 2024 13:20:38 -0400
Subject: [PATCH 3/4] GP-3878 Corrected ELF x86 32-bit PLT processing issue
---
.../elf/extend/X86_32_ElfExtension.java | 67 +++++++++++--------
1 file changed, 40 insertions(+), 27 deletions(-)
diff --git a/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/extend/X86_32_ElfExtension.java b/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/extend/X86_32_ElfExtension.java
index 14e33fcbd2..4fefee33e5 100644
--- a/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/extend/X86_32_ElfExtension.java
+++ b/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/extend/X86_32_ElfExtension.java
@@ -54,18 +54,18 @@ public class X86_32_ElfExtension extends ElfExtension {
}
super.processGotPlt(elfLoadHelper, monitor);
-
- processX86Plt(elfLoadHelper, monitor);
+
+ processX86PltSections(elfLoadHelper, monitor);
}
/**
* Handle the case where GOT entry offset are computed based upon EBX.
* This implementation replaces the old "magic map" which had previously been used.
- * @param elfLoadHelper
- * @param monitor
- * @throws CancelledException
+ * @param elfLoadHelper ELF load helper
+ * @param monitor task monitor
+ * @throws CancelledException thrown if load cancelled
*/
- private void processX86Plt(ElfLoadHelper elfLoadHelper, TaskMonitor monitor) throws CancelledException {
+ private void processX86PltSections(ElfLoadHelper elfLoadHelper, TaskMonitor monitor) throws CancelledException {
// TODO: Does 64-bit have a similar mechanism?
@@ -73,37 +73,50 @@ public class X86_32_ElfExtension extends ElfExtension {
// the unresolved issue is to determine the length of the PLT area without a section
ElfHeader elfHeader = elfLoadHelper.getElfHeader();
- ElfSectionHeader pltSection = elfHeader.getSection(ElfSectionHeaderConstants.dot_plt);
- if (pltSection == null || !pltSection.isExecutable()) {
- return;
- }
-
ElfDynamicTable dynamicTable = elfHeader.getDynamicTable();
if (dynamicTable == null || !dynamicTable.containsDynamicValue(ElfDynamicType.DT_PLTGOT)) {
return; // avoid NotFoundException which causes issues for importer
}
- Program program = elfLoadHelper.getProgram();
- Memory memory = program.getMemory();
-
- // MemoryBlock pltBlock = getBlockPLT(pltSection);
- MemoryBlock pltBlock = memory.getBlock(pltSection.getNameAsString());
- if (pltBlock == null) {
- return;
- }
-
- // Paint pltgot base over .plt section to allow thunks to be resolved during analysis
- Register ebxReg = program.getRegister("EBX");
+ long pltgotOffset;
try {
- long pltgotOffset = elfHeader.adjustAddressForPrelink(dynamicTable.getDynamicValue(
- ElfDynamicType.DT_PLTGOT));
+ pltgotOffset = elfHeader.adjustAddressForPrelink(dynamicTable.getDynamicValue(
+ ElfDynamicType.DT_PLTGOT));
pltgotOffset = elfLoadHelper.getDefaultAddress(pltgotOffset).getOffset(); // adjusted for image base
- RegisterValue pltgotValue = new RegisterValue(ebxReg, BigInteger.valueOf(pltgotOffset));
- program.getProgramContext().setRegisterValue(pltBlock.getStart(), pltBlock.getEnd(), pltgotValue);
- } catch (NotFoundException | ContextChangeException e) {
+ }
+ catch (NotFoundException e) {
throw new AssertException("unexpected", e);
}
+
+ Program program = elfLoadHelper.getProgram();
+ Register ebxReg = program.getRegister("EBX");
+ Memory memory = program.getMemory();
+
+ String pltPrefix = ElfSectionHeaderConstants.dot_plt + ".";
+ for (ElfSectionHeader section : elfHeader.getSections()) {
+ monitor.checkCancelled();
+ String sectionName = section.getNameAsString();
+ if (!section.isExecutable()) {
+ continue;
+ }
+ if (sectionName.equals(ElfSectionHeaderConstants.dot_plt) || sectionName.startsWith(pltPrefix)) {
+
+ MemoryBlock pltBlock = memory.getBlock(sectionName);
+ if (pltBlock == null) {
+ elfLoadHelper.log("Skipped processing of " + sectionName + ": memory block not found");
+ continue;
+ }
+
+ // Paint pltgot base over .plt section as EBX value to allow thunks to be resolved during analysis
+ try {
+ RegisterValue pltgotValue = new RegisterValue(ebxReg, BigInteger.valueOf(pltgotOffset));
+ program.getProgramContext().setRegisterValue(pltBlock.getStart(), pltBlock.getEnd(), pltgotValue);
+ } catch (ContextChangeException e) {
+ throw new AssertException("unexpected", e);
+ }
+ }
+ }
}
}
From 1e4882d82d9d5ca367228a8fd0ab999b998ae3d2 Mon Sep 17 00:00:00 2001
From: d-millar <33498836+d-millar@users.noreply.github.com>
Date: Thu, 6 Jun 2024 21:33:03 +0000
Subject: [PATCH 4/4] GP-0: fix for opinion failures in dbgeng
---
.../Debugger-agent-dbgeng/data/support/local-dbgeng.py | 9 ++++++---
.../src/main/py/src/ghidradbg/arch.py | 9 ++++++---
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/data/support/local-dbgeng.py b/Ghidra/Debug/Debugger-agent-dbgeng/data/support/local-dbgeng.py
index bf32012a3c..6d95b403c1 100644
--- a/Ghidra/Debug/Debugger-agent-dbgeng/data/support/local-dbgeng.py
+++ b/Ghidra/Debug/Debugger-agent-dbgeng/data/support/local-dbgeng.py
@@ -39,6 +39,7 @@ else:
def main():
# Delay these imports until sys.path is patched
from ghidradbg import commands as cmd
+ from ghidradbg.hooks import on_stop
from ghidradbg.util import dbg
# So that the user can re-enter by typing repl()
@@ -51,15 +52,17 @@ def main():
args = ' ' + args
cmd.ghidra_trace_create(
os.getenv('OPT_TARGET_IMG') + args, start_trace=False)
- cmd.ghidra_trace_start(os.getenv('OPT_TARGET_IMG'))
- cmd.ghidra_trace_sync_enable()
-
+
# TODO: HACK
try:
dbg.wait()
except KeyboardInterrupt as ki:
dbg.interrupt()
+ cmd.ghidra_trace_start(os.getenv('OPT_TARGET_IMG'))
+ cmd.ghidra_trace_sync_enable()
+
+ on_stop()
cmd.repl()
diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/arch.py b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/arch.py
index a6722c2a95..0e40cdc420 100644
--- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/arch.py
+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/arch.py
@@ -20,7 +20,8 @@ from . import util
language_map = {
- 'ARM': ['AARCH64:BE:64:v8A', 'AARCH64:LE:64:AppleSilicon', 'AARCH64:LE:64:v8A', 'ARM:BE:64:v8', 'ARM:LE:64:v8'],
+ 'AARCH64': ['AARCH64:LE:64:AppleSilicon'],
+ 'ARM': ['ARM:LE:32:v8'],
'Itanium': [],
'x86': ['x86:LE:32:default'],
'x86_64': ['x86:LE:64:default'],
@@ -37,7 +38,7 @@ x86_compiler_map = {
}
arm_compiler_map = {
- 'windows': 'windows',
+ 'windows': 'default',
}
compiler_map = {
@@ -57,12 +58,14 @@ def get_arch():
try:
type = util.dbg.get_actual_processor_type()
except Exception:
- #print("Error getting actual processor type.")
+ print("Error getting actual processor type.")
return "Unknown"
if type is None:
return "x86_64"
if type == 0x8664:
return "x86_64"
+ if type == 0xAA64:
+ return "AARCH64"
if type == 0x014c:
return "x86"
if type == 0x01c0: