Skip to content

Commit 07a08e0

Browse files
Merge branch 'qilingframework:dev' into dev
2 parents a4522ec + b945456 commit 07a08e0

File tree

8 files changed

+20
-23
lines changed

8 files changed

+20
-23
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ test.file
3636
core
3737
*.perf
3838
tests/output.txt
39+
tests/testtest_*
3940

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM python:3.8-slim AS builder
33
LABEL maintainer="Kevin Foo <[email protected]>"
44

55
ENV DEBIAN_FRONTEND=noninteractive
6+
ENV AM_I_IN_A_DOCKER_CONTAINER Yes
67

78
RUN apt-get update \
89
&& apt-get -y upgrade \

qiling/const.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,14 @@ class QL_INTERCEPT(IntEnum):
5151

5252
QL_DEBUGGER_ALL = (QL_DEBUGGER.IDAPRO, QL_DEBUGGER.GDB, QL_DEBUGGER.QDB)
5353

54-
QL_ARCH_MCU32 = (QL_ARCH.CORTEX_M,)
55-
QL_ARCH_MCU = QL_ARCH_MCU32
56-
5754
QL_ARCH_ENDIAN = (QL_ARCH.MIPS, QL_ARCH.ARM)
5855
QL_ARCH_1BIT = (QL_ARCH.EVM,)
5956
QL_ARCH_16BIT = (QL_ARCH.A8086,)
60-
QL_ARCH_32BIT = (QL_ARCH.ARM, QL_ARCH.ARM_THUMB, QL_ARCH.MIPS, QL_ARCH.X86) + QL_ARCH_MCU32
57+
QL_ARCH_32BIT = (QL_ARCH.ARM, QL_ARCH.ARM_THUMB, QL_ARCH.MIPS, QL_ARCH.X86, QL_ARCH.CORTEX_M)
6158
QL_ARCH_64BIT = (QL_ARCH.ARM64, QL_ARCH.X8664)
6259

6360
QL_OS_NONPID = (QL_OS.DOS, QL_OS.UEFI)
64-
QL_ARCH_HARDWARE = QL_ARCH_MCU
61+
QL_ARCH_HARDWARE = (QL_ARCH.CORTEX_M,)
6562
QL_ARCH_NONEOS = (QL_ARCH.EVM,)
6663
QL_OS_POSIX = (QL_OS.LINUX, QL_OS.FREEBSD, QL_OS.MACOS, QL_OS.QNX)
6764
QL_OS_ALL = QL_OS_POSIX + QL_OS_NONPID + (QL_OS.WINDOWS,)

qiling/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ def filter(self, ft):
609609
def uc(self) -> Uc:
610610
""" Raw uc instance.
611611
612-
Type: Uc
612+
Type: Ucgit
613613
"""
614614
return self._uc
615615

@@ -864,7 +864,7 @@ def stop(self):
864864
self.arch.stop()
865865

866866
else:
867-
self.uc.emu_stop()
867+
self.uc.emu_stop()
868868

869869
# start emulation
870870
def emu_start(self, begin, end, timeout=0, count=0):

qiling/core_struct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, endian: QL_ENDIAN, bit: int):
3030
self._fmt32s = f'{modifier}i'
3131
self._fmt64 = f'{modifier}Q'
3232
self._fmt64s = f'{modifier}q'
33-
33+
3434
handlers = {
3535
64 : (self.pack64, self.pack64s, self.unpack64, self.unpack64s),
3636
32 : (self.pack32, self.pack32s, self.unpack32, self.unpack32s),

qiling/os/posix/syscall/unistd.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,13 @@ def _type_mapping(ent):
687687
d_type = _type_mapping(result)
688688
d_reclen = n + n + 2 + len(d_name) + 1
689689

690+
# TODO: Dirty fix for X8664 MACOS 11.6 APFS
691+
# For some reason MACOS return int value is 64bit
692+
try:
693+
packed_d_ino = (ql.pack(d_ino), n)
694+
except:
695+
packed_d_ino = (ql.pack64(d_ino), n)
696+
690697
if is_64:
691698
fields = (
692699
(ql.pack(d_ino), n),
@@ -697,7 +704,7 @@ def _type_mapping(ent):
697704
)
698705
else:
699706
fields = (
700-
(ql.pack(d_ino), n),
707+
packed_d_ino,
701708
(ql.pack(d_off), n),
702709
(ql.pack16(d_reclen), 2),
703710
(d_name, len(d_name)),

tests/test_elf_multithread.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def test_elf_linux_execve_x8664(self):
3434
del QL_TEST
3535
del ql
3636

37+
3738
def test_elf_linux_cloexec_x8664(self):
3839
with open('../examples/rootfs/x8664_linux/testfile', 'wb') as f:
3940
f.write(b'0123456789')
@@ -149,9 +150,6 @@ def check_write(ql, write_fd, write_buf, write_count, *args, **kw):
149150

150151

151152
def test_tcp_elf_linux_x86(self):
152-
if platform.system() == "Darwin" and platform.machine() == "arm64":
153-
return
154-
155153
def check_write(ql, write_fd, write_buf, write_count, *args, **kw):
156154
try:
157155
buf = ql.mem.read(write_buf, write_count)
@@ -170,9 +168,6 @@ def check_write(ql, write_fd, write_buf, write_count, *args, **kw):
170168

171169

172170
def test_tcp_elf_linux_x8664(self):
173-
if platform.system() == "Darwin" and platform.machine() == "arm64":
174-
return
175-
176171
def check_write(ql, write_fd, write_buf, write_count, *args, **kw):
177172
try:
178173
buf = ql.mem.read(write_buf, write_count)
@@ -242,9 +237,6 @@ def test_tcp_elf_linux_mips32el(self):
242237

243238

244239
def test_udp_elf_linux_x86(self):
245-
if platform.system() == "Darwin" and platform.machine() == "arm64":
246-
return
247-
248240
def check_write(ql, write_fd, write_buf, write_count, *args, **kw):
249241
try:
250242
buf = ql.mem.read(write_buf, write_count)
@@ -264,9 +256,6 @@ def check_write(ql, write_fd, write_buf, write_count, *args, **kw):
264256

265257

266258
def test_udp_elf_linux_x8664(self):
267-
if platform.system() == "Darwin" and platform.machine() == "arm64":
268-
return
269-
270259
def check_write(ql, write_fd, write_buf, write_count, *args, **kw):
271260
try:
272261
buf = ql.mem.read(write_buf, write_count)

tests/test_evm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#!/usr/bin/env python3
22

3-
import platform, sys, unittest
3+
import os, platform, sys, unittest
44

55
sys.path.append("..")
66
from qiling import Qiling
77

8-
if sys.version_info.major == 3 and sys.version_info.minor == 9:
8+
SECRET_KEY = os.environ.get('AM_I_IN_A_DOCKER_CONTAINER', False)
9+
10+
if SECRET_KEY:
911
sys.exit(0)
1012

1113
if platform.system() == "Darwin" and platform.machine() == "arm64":

0 commit comments

Comments
 (0)