smallworld-re 1.0.1__py3-none-any.whl → 1.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,6 +33,7 @@ class Executable(memory.RawMemory):
33
33
  address: typing.Optional[int] = None,
34
34
  platform: typing.Optional[Platform] = None,
35
35
  ignore_platform: bool = False,
36
+ page_size: int = 0x1000,
36
37
  ):
37
38
  """Load an ELF executable from an open file-like object.
38
39
 
@@ -41,6 +42,7 @@ class Executable(memory.RawMemory):
41
42
  address: The address where this executable should be loaded.
42
43
  platform: Optional platform for header verification
43
44
  ignore_platform: Skip platform ID and verification
45
+ page_size: Page size in bytes
44
46
 
45
47
  Returns:
46
48
  An Executable parsed from the given ELF file-like object.
@@ -50,7 +52,11 @@ class Executable(memory.RawMemory):
50
52
  from .elf import ElfExecutable
51
53
 
52
54
  return ElfExecutable(
53
- file, user_base=address, platform=platform, ignore_platform=ignore_platform
55
+ file,
56
+ user_base=address,
57
+ platform=platform,
58
+ ignore_platform=ignore_platform,
59
+ page_size=page_size,
54
60
  )
55
61
 
56
62
  @classmethod
@@ -368,6 +368,7 @@ class ElfExecutable(Executable):
368
368
  # File base is defined.
369
369
  # We (probably) cannot move the image without problems.
370
370
  raise ConfigurationError("Base address defined for fixed-position ELF")
371
+ log.info(f"Address: {self.address:x}")
371
372
 
372
373
  def _rebase_file(self, val: int):
373
374
  # Rebase an offset from file-relative to image-relative
@@ -389,16 +390,22 @@ class ElfExecutable(Executable):
389
390
  seg_size = self._page_align(phdr.virtual_size + (phdr.file_offset - seg_start))
390
391
 
391
392
  log.debug("Mapping: ")
392
- log.debug(f" f: [ {seg_start:012x} -> {seg_end:012x} ]")
393
- log.debug(f" m: [ {seg_addr:012x} -> {seg_addr + seg_size:012x} ]")
393
+ log.debug(
394
+ f" f: [ {seg_start:012x} -> {seg_end:012x} ] ( {seg_end - seg_start:x} bytes )"
395
+ )
396
+ log.debug(
397
+ f" m: [ {seg_addr:012x} -> {seg_addr + seg_size:012x} ] ( {seg_size:x} bytes )"
398
+ )
394
399
 
395
400
  # Extract segment data
396
401
  seg_data = image[seg_start:seg_end]
397
402
  if len(seg_data) < seg_size:
398
403
  # Segment is shorter than is available from the file;
399
404
  # this will get zero-padded.
400
- seg_data += b"\0" * (seg_size - (seg_start - seg_end))
401
- elif len(seg_data) != seg_size:
405
+ pad_size = seg_size - len(seg_data)
406
+ log.debug(f"Padding segment by {pad_size} bytes")
407
+ seg_data += b"\0" * pad_size
408
+ if len(seg_data) != seg_size:
402
409
  raise ConfigurationError(
403
410
  f"Expected segment of size {seg_size}, but got {len(seg_data)}"
404
411
  )
@@ -408,6 +415,9 @@ class ElfExecutable(Executable):
408
415
 
409
416
  # Add the segment to the memory map
410
417
  seg_value = BytesValue(seg_data, None)
418
+ assert (
419
+ seg_value._size == seg_size
420
+ ), f"Expected {seg_size:x} bytes, got {seg_value._size:x}"
411
421
  self[seg_addr - self.address] = seg_value
412
422
 
413
423
  def _extract_symbols(self, elf):
@@ -1,20 +1,20 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: smallworld-re
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: An emulation stack tracking library
5
5
  Home-page: https://github.com/smallworld-re/smallworld
6
6
  Author: MIT Lincoln Laboratory
7
7
  Author-email: smallworld@ll.mit.edu
8
8
  License: MIT
9
- Requires-Python: >=3.8
9
+ Requires-Python: >=3.10
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE.txt
12
- Requires-Dist: unicorn
13
- Requires-Dist: angr
14
- Requires-Dist: capstone
15
- Requires-Dist: lief
16
- Requires-Dist: pyhidra
17
- Requires-Dist: pypcode
12
+ Requires-Dist: pyhidra==1.3.0
13
+ Requires-Dist: angr==9.2.137
14
+ Requires-Dist: capstone==5.0.3
15
+ Requires-Dist: lief==0.14.1
16
+ Requires-Dist: pypcode==3.0
17
+ Requires-Dist: unicorn==2.0.1.post1
18
18
  Provides-Extra: development
19
19
  Requires-Dist: black; extra == "development"
20
20
  Requires-Dist: isort; extra == "development"
@@ -30,6 +30,7 @@ Dynamic: description
30
30
  Dynamic: description-content-type
31
31
  Dynamic: home-page
32
32
  Dynamic: license
33
+ Dynamic: license-file
33
34
  Dynamic: provides-extra
34
35
  Dynamic: requires-dist
35
36
  Dynamic: requires-python
@@ -122,11 +122,11 @@ smallworld/state/cpus/powerpc.py,sha256=Nbn1J3uFEHX1JFUXIOdsyGcMgg5DCrVADColS0Ys
122
122
  smallworld/state/cpus/riscv.py,sha256=-K5020y3VPiKPZUqRnBhSZiQrMwaJbahc07HSm_V-zQ,13467
123
123
  smallworld/state/cpus/xtensa.py,sha256=vZi8XMKrmNF1GF9M3sdxzKHoyXl_cSKcSJuOFE6Mzh0,2421
124
124
  smallworld/state/memory/__init__.py,sha256=qB1XKT-WDl40rNlAYssdwYIckXt_swUUv6x6MR6wrSY,251
125
- smallworld/state/memory/code.py,sha256=-Ob3dRTUeZX_tiSF9_ihuROMdxVxCWXxz26JICoR5tc,2204
125
+ smallworld/state/memory/code.py,sha256=HFeVBT7QRl8z6MypAB3fre-kwjLQcAQuHWcmSU4oHHE,2349
126
126
  smallworld/state/memory/heap.py,sha256=Z_Hcyx2XrKx_JJaShHUSsLk1GVV67i0sC5VvozX5vTg,2652
127
127
  smallworld/state/memory/memory.py,sha256=fxGW63fmPMCHHKkydnWWq2Ib8zrU_ZIWdML4__jYEsc,5733
128
128
  smallworld/state/memory/elf/__init__.py,sha256=M9GY8Pl9zjCM8oDlpsSByPLdJ4d-uHMW1WDhjUodc4M,60
129
- smallworld/state/memory/elf/elf.py,sha256=gMzss64Tkp50QebeaCaMj_7hWCqDjMvLAAy4irr4eu4,22711
129
+ smallworld/state/memory/elf/elf.py,sha256=czDMuh-TC9Mt5n9YT3s0zvWi-7mQDVJJvSLv74cQ_HU,23065
130
130
  smallworld/state/memory/elf/structs.py,sha256=VfZQU-9rwQkQrxq6mfOqeNVUyM3AeTwPzUEGuD0389I,1776
131
131
  smallworld/state/memory/elf/rela/__init__.py,sha256=tMyIFKogMSIpVzuKVzOqftqKfhzKNx5V0l_5hsIg5Lc,828
132
132
  smallworld/state/memory/elf/rela/aarch64.py,sha256=WMdYmmd1U8srlayVdL3ZASOSzfvFtlmPpmQlCZsm1Ts,936
@@ -158,9 +158,9 @@ smallworld/state/models/x86/microsoftcdecl.py,sha256=tSWxBYsJ3hS9wFbbaGmqKlxbzN_
158
158
  smallworld/state/models/x86/systemv.py,sha256=0U_WjoeBP5uuwJkkgmbV4r0S1r9VL3lE19YEH8edgtY,5101
159
159
  smallworld/state/unstable/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
160
160
  smallworld/state/unstable/elf.py,sha256=icgNvR53vzixYGQHZuAPo2Iu1p45DuGcrx-0BMz1hX8,15475
161
- smallworld_re-1.0.1.dist-info/LICENSE.txt,sha256=hJgzoM94yZXUpdbqkggYvqC5yAhrvy7Mi6hPKKUhu5I,1083
162
- smallworld_re-1.0.1.dist-info/METADATA,sha256=R70iiU9BBcIwqayws_gWtBbWQCC1KO4jsa_cU4qwbFM,6088
163
- smallworld_re-1.0.1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
164
- smallworld_re-1.0.1.dist-info/entry_points.txt,sha256=bP2uJRrjWRJ4wCDYTVX-XbUvyJAqUz6P1NgUTbONz2g,56
165
- smallworld_re-1.0.1.dist-info/top_level.txt,sha256=fHjt8xbQdfHStalSy4-pP9Jv6WfDtRH6S9UPw6KMrwk,11
166
- smallworld_re-1.0.1.dist-info/RECORD,,
161
+ smallworld_re-1.0.3.dist-info/licenses/LICENSE.txt,sha256=hJgzoM94yZXUpdbqkggYvqC5yAhrvy7Mi6hPKKUhu5I,1083
162
+ smallworld_re-1.0.3.dist-info/METADATA,sha256=adSI7Hapd_iKQdwpGe7TT0gRJy_WbgNaIHqiZ4ZSiE0,6160
163
+ smallworld_re-1.0.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
164
+ smallworld_re-1.0.3.dist-info/entry_points.txt,sha256=bP2uJRrjWRJ4wCDYTVX-XbUvyJAqUz6P1NgUTbONz2g,56
165
+ smallworld_re-1.0.3.dist-info/top_level.txt,sha256=fHjt8xbQdfHStalSy4-pP9Jv6WfDtRH6S9UPw6KMrwk,11
166
+ smallworld_re-1.0.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5