Skip to content

Commit d4834ec

Browse files
committed
REL: remove support for TrampolineMinimalPair2and3
1 parent 4de6cef commit d4834ec

File tree

10 files changed

+42
-424
lines changed

10 files changed

+42
-424
lines changed

chb/app/CHVersion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
chbversion: str = "0.3.0-20250823"
1+
chbversion: str = "0.3.0-20250825"

chb/app/CfgBlock.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ------------------------------------------------------------------------------
55
# The MIT License (MIT)
66
#
7-
# Copyright (c) 2021-2024 Aarno Labs LLC
7+
# Copyright (c) 2021-2025 Aarno Labs LLC
88
#
99
# Permission is hereby granted, free of charge, to any person obtaining a copy
1010
# of this software and associated documentation files (the "Software"), to deal
@@ -92,10 +92,6 @@ def is_in_trampoline(self) -> bool:
9292
def is_trampoline(self) -> bool:
9393
return False
9494

95-
@property
96-
def is_trampoline_minimal_pair_2_and_3(self) -> bool:
97-
return False
98-
9995
@property
10096
def roles(self) -> Dict[str, str]:
10197
return {}

chb/arm/ARMCfg.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ------------------------------------------------------------------------------
55
# The MIT License (MIT)
66
#
7-
# Copyright (c) 2021-2024 Aarno Labs LLC
7+
# Copyright (c) 2021-2025 Aarno Labs LLC
88
#
99
# Permission is hereby granted, free of charge, to any person obtaining a copy
1010
# of this software and associated documentation files (the "Software"), to deal
@@ -201,12 +201,6 @@ def get_inlinemap_addrs(start: str, size: int) -> List[str]:
201201

202202
trampolines[baddr] = trinfo = TrampolineInfo(patchevent)
203203

204-
if patchevent.is_trampoline_pair_minimal_2_and_3:
205-
chklogger.logger.info("Trampoline pair minimal 2 and 3 %s", baddr)
206-
trinfo.add_role("payload", baddr)
207-
trampolineblocks[baddr] = baddr
208-
continue
209-
210204
trinfo.add_role("setupblock", baddr)
211205
trampolineblocks[baddr] = baddr
212206

chb/arm/ARMCfgBlock.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ------------------------------------------------------------------------------
55
# The MIT License (MIT)
66
#
7-
# Copyright (c) 2021-2024 Aarno Labs LLC
7+
# Copyright (c) 2021-2025 Aarno Labs LLC
88
#
99
# Permission is hereby granted, free of charge, to any person obtaining a copy
1010
# of this software and associated documentation files (the "Software"), to deal
@@ -129,10 +129,6 @@ def lastaddr(self) -> str:
129129
def is_trampoline(self) -> bool:
130130
return self.trampoline_info.patchevent.is_trampoline
131131

132-
@property
133-
def is_trampoline_minimal_pair_2_and_3(self) -> bool:
134-
return self.trampoline_info.patchevent.is_trampoline_pair_minimal_2_and_3
135-
136132
@property
137133
def trampoline_info(self) -> "TrampolineInfo":
138134
return self._trinfo

chb/cmdline/PatchResults.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,9 @@ def logicalva(self) -> str:
320320
def is_trampoline(self) -> bool:
321321
return self.patchkind == "Trampoline"
322322

323-
@property
324-
def is_trampoline_pair_minimal_2_and_3(self) -> bool:
325-
return self.patchkind == "TrampolinePairMinimal2and3"
326-
327323
@property
328324
def is_supported(self) -> bool:
329-
return (self.is_trampoline or self.is_trampoline_pair_minimal_2_and_3)
325+
return self.is_trampoline
330326

331327
def has_details(self) -> bool:
332328
return "details" in self._d
@@ -435,16 +431,6 @@ def trampoline_addresses(self) -> List[Dict[str, str]]:
435431
if e.case_fallthrough_jump is not None:
436432
r["fallthrough-jump"] = e.case_fallthrough_jump
437433
result.append(r)
438-
elif e.is_trampoline_pair_minimal_2_and_3:
439-
r["logicalva"] = e.logicalva
440-
r["kind"] = "trampoline-pair-minimal-2-and-3"
441-
if e.has_wrapper():
442-
r["wrapper"] = e.wrapper.vahex
443-
if e.has_fallthrough_destination() and e.fallthrough_destination:
444-
r["fallthrough"] = e.fallthrough_destination
445-
if e.case_fallthrough_jump is not None:
446-
r["fallthrough-jump"] = e.case_fallthrough_jump
447-
result.append(r)
448434
return result
449435

450436

chb/cmdline/astcmds.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,7 @@ def buildast(args: argparse.Namespace) -> NoReturn:
182182
if patchresultsdata is not None:
183183
patchresults = PatchResults(patchresultsdata)
184184
for event in patchresults.events:
185-
if (
186-
event.is_trampoline
187-
or event.is_trampoline_pair_minimal_2_and_3):
185+
if event.is_trampoline:
188186
if event.has_wrapper():
189187
startaddr = event.wrapper.vahex
190188
patchevents[startaddr] = event

chb/cmdline/relationalcmds.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ------------------------------------------------------------------------------
55
# The MIT License (MIT)
66
#
7-
# Copyright (c) 2021-2024 Aarno Labs, LLC
7+
# Copyright (c) 2021-2025 Aarno Labs, LLC
88
#
99
# Permission is hereby granted, free of charge, to any person obtaining a copy
1010
# of this software and associated documentation files (the "Software"), to deal
@@ -372,9 +372,7 @@ def _relational_compare_generate_json(xname1: str,
372372
if patchresultsdata is not None:
373373
patchresults = PatchResults(patchresultsdata)
374374
for event in patchresults.events:
375-
if (
376-
event.is_trampoline
377-
or event.is_trampoline_pair_minimal_2_and_3):
375+
if event.is_trampoline:
378376
if event.has_wrapper():
379377
startaddr = event.wrapper.vahex
380378
patchevents[startaddr] = event
@@ -600,9 +598,7 @@ def relational_compare_cfgs_cmd(args: argparse.Namespace) -> NoReturn:
600598
if patchresultsdata is not None:
601599
patchresults = PatchResults(patchresultsdata)
602600
for event in patchresults.events:
603-
if (
604-
event.is_trampoline
605-
or event.is_trampoline_pair_minimal_2_and_3):
601+
if event.is_trampoline:
606602
if event.has_wrapper():
607603
startaddr = event.wrapper.vahex
608604
patchevents[startaddr] = event

chb/jsoninterface/JSONFunctionComparison.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,6 @@ def trampoline_address(self) -> Optional[str]:
9595
if role == "setupblock":
9696
return b_addr
9797

98-
else:
99-
# the TrampolinePairMinimal2and3 patch has just one block: payload
100-
# (which is called wrapper in the patch results file)
101-
for (b_addr, role) in self.cfg2_blocks:
102-
if role == "payload":
103-
return b_addr
104-
10598
return None
10699

107100
def accept(self, visitor: "JSONObjectVisitor") -> None:

chb/relational/FunctionRelationalAnalysis.py

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ------------------------------------------------------------------------------
55
# The MIT License (MIT)
66
#
7-
# Copyright (c) 2021-2024 Aarno Labs, LLC
7+
# Copyright (c) 2021-2025 Aarno Labs, LLC
88
#
99
# Permission is hereby granted, free of charge, to any person obtaining a copy
1010
# of this software and associated documentation files (the "Software"), to deal
@@ -384,11 +384,6 @@ def block_analyses(self) -> Mapping[str, BlockRelationalAnalysis]:
384384
trampoline = self.has_trampoline()
385385
if trampoline is not None:
386386
self.setup_trampoline_analysis(trampoline)
387-
else:
388-
trampoline_minimal_pair_2_and_3 = self.has_minimal_pair_2_and_3_trampoline()
389-
if trampoline_minimal_pair_2_and_3 is not None:
390-
self.setup_minimal_pair_2_and_3_trampoline_analysis(
391-
trampoline_minimal_pair_2_and_3)
392387

393388
return self._blockanalyses
394389

@@ -408,8 +403,8 @@ def setup_trampoline_analysis(self, b: str) -> None:
408403
tpre[0] in cfg2unmapped
409404
and tpost[0] in cfg2unmapped
410405
and tpre[0] in cfg1unmapped):
411-
# Case where trampoline has an early return and a fallthrough case
412-
# (what we mark as the exit block)
406+
# Case where trampoline has an early return and a fallthrough
407+
# case (what we mark as the exit block)
413408
roles["entry"] = self.basic_blocks2[tpre[0]]
414409
roles["exit"] = self.basic_blocks2[tpost[0]]
415410
for (role, addr) in trampoline.roles.items():
@@ -420,33 +415,40 @@ def setup_trampoline_analysis(self, b: str) -> None:
420415
self.app2,
421416
roles)
422417
else:
423-
chklogger.logger.warning("Found unhandled trampoline case. Should be an early return "
424-
"trampoline (pre %s, post %s), but the blocks are not "
425-
"in the unmapped lists. cfg1: %s, cfg2: %s",
426-
tpre[0], tpost[0], cfg1unmapped, cfg2unmapped)
418+
chklogger.logger.warning(
419+
"Found unhandled trampoline case. Should be an early "
420+
"return trampoline (pre %s, post %s), but the blocks "
421+
" are not in the unmapped lists. cfg1: %s, cfg2: %s",
422+
tpre[0], tpost[0], cfg1unmapped, cfg2unmapped)
427423
elif len(tpre) == 1 and len(tpost) == 2:
428424
# Trampoline has a continue statement.
429-
# One of the post blocks is the fallthrough/exit, one is the loop continuation.
425+
# One of the post blocks is the fallthrough/exit, one is the
426+
# loop continuation.
430427
# Need to figure out which one is which
431428
if not 'continuepath' in trampoline.roles:
432-
chklogger.logger.error("Found unsupported trampoline case, "
433-
"There are 2 post trampoline blocks %s but no continuepath role %s",
434-
tpost, trampoline.roles)
429+
chklogger.logger.error(
430+
"Found unsupported trampoline case, "
431+
"There are 2 post trampoline blocks %s but no "
432+
"continuepath role %s",
433+
tpost, trampoline.roles)
435434
return
436435

437436
cont = self.basic_blocks2[trampoline.roles['continuepath']]
438437
cont_post = self.cfg2.edges[cont.baddr]
439438
if len(cont_post) != 1:
440-
chklogger.logger.error("Found unsupported trampoline case, "
441-
"continue block %s has more than one outgoing edges: %s",
442-
cont.baddr, cont_post)
439+
chklogger.logger.error(
440+
"Found unsupported trampoline case, "
441+
"continue block %s has more than one outgoing edges: %s",
442+
cont.baddr, cont_post)
443443
return
444444
fallthrough = self.basic_blocks2[trampoline.roles['fallthrough']]
445445
fallthrough_post = self.cfg2.edges[fallthrough.baddr]
446446
if len(fallthrough_post) != 1:
447-
chklogger.logger.error("Found unsupported trampoline case, "
448-
"fallthrough block %s has more than one outgoing edges: %s",
449-
fallthrough.baddr, fallthrough_post)
447+
chklogger.logger.error(
448+
"Found unsupported trampoline case, "
449+
"fallthrough block %s has more than one outgoing edges: "
450+
"%s",
451+
fallthrough.baddr, fallthrough_post)
450452
return
451453

452454
roles["entry"] = self.basic_blocks2[tpre[0]]
@@ -459,9 +461,10 @@ def setup_trampoline_analysis(self, b: str) -> None:
459461
self.app2,
460462
roles)
461463
else:
462-
chklogger.logger.warning("Found unhandled trampoline case. Have %d pre-blocks "
463-
"%d post-blocks. pre: %s, post %s",
464-
len(tpre), len(tpost), tpre, tpost)
464+
chklogger.logger.warning(
465+
"Found unhandled trampoline case. Have %d pre-blocks "
466+
"%d post-blocks. pre: %s, post %s",
467+
len(tpre), len(tpost), tpre, tpost)
465468

466469
def setup_minimal_pair_2_and_3_trampoline_analysis(self, b: str) -> None:
467470
chklogger.logger.info("Setup minimal_pair_2_and_3_trampoline at %s", b)
@@ -494,12 +497,6 @@ def has_trampoline(self) -> Optional[str]:
494497
return b
495498
return None
496499

497-
def has_minimal_pair_2_and_3_trampoline(self) -> Optional[str]:
498-
for (b, cfgb) in self.cfgtc_blocks2.items():
499-
if cfgb.is_trampoline_minimal_pair_2_and_3:
500-
return b
501-
return None
502-
503500
def blocks_changed(self) -> List[str]:
504501
"""Return a list of block addresses that are not md5-equal."""
505502

0 commit comments

Comments
 (0)