8000 Use global cwd in thread by bet4it · Pull Request #1170 · qilingframework/qiling · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use global cwd in thread #1170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- Mark Jansen (learn-more)
- cq674350529
- bkerler (viperbjk)
- bet4it


#### Contributors (in no particular order)
Expand All @@ -53,7 +54,6 @@
- madprogrammer
- danielmoos
- sigeryang
- bet4it
- nullableVoidPtr


Expand Down
11 changes: 0 additions & 11 deletions qiling/os/linux/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from qiling.os.thread import *
from qiling.arch.x86_const import *
from qiling.exception import QlErrorExecutionStop
from qiling.os.path import QlOsPath

LINUX_THREAD_ID = 2000

Expand All @@ -38,7 +37,6 @@ def __init__(self, ql: Qiling, start_address: int, exit_point: int, context = No
self._start_address = start_address
self._status = THREAD_STATUS_RUNNING
self._return_val = 0
self.path = self.ql.os.path
self._log_file_fd = None
self._sched_cb = None

8000 Expand Down Expand Up @@ -135,14 +133,6 @@ def return_val(self):
def return_val(self, rv):
self._return_val = rv

@property
def path(self):
return self._path

@path.setter
def path(self, p: QlOsPath):
self._path = QlOsPath(self.ql.rootfs, p.cwd, self.ql.os.type)

@property
def log_file_fd(self):
return self._log_file_fd
Expand Down Expand Up @@ -295,7 +285,6 @@ def clone(self):
# Caveat:
# Don't use thread id to identify the thread object.
new_thread = self.ql.os.thread_class.spawn(self._ql, self._start_address, self._exit_point, self._saved_context, set_child_tid_addr = None, thread_id = self._thread_id)
new_thread._path = self._path
new_thread._return_val = self._return_val
new_thread._robust_list_head_len = self._robust_list_head_len
new_thread._robust_list_head_ptr = self._robust_list_head_ptr
Expand Down
1 change: 0 additions & 1 deletion qiling/os/posix/syscall/sched.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def ql_syscall_clone(ql: Qiling, flags: int, child_stack: int, parent_tidptr: in
set_child_tid_addr = child_tidptr

th = ql.os.thread_class.spawn(ql, ql.arch.regs.arch_pc + 2, ql.os.exit_point, set_child_tid_addr = set_child_tid_addr)
th.path = f_th.path
ql.log.debug(f'{str(th)} created')

if flags & CLONE_PARENT_SETTID == CLONE_PARENT_SETTID:
Expand Down
6 changes: 1 addition & 5 deletions qiling/os/posix/syscall/unistd.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,7 @@ def ql_syscall_chdir(ql: Qiling, path_name: int):
relative_path = ql.os.path.transform_to_relative_path(pathname)

if os.path.exists(real_path) and os.path.isdir(real_path):
if ql.os.thread_management:
ql.os.thread_management.cur_thread.path.cwd = relative_path
else:
ql.os.path.cwd = relative_path

ql.os.path.cwd = relative_path
regreturn = 0
ql.log.debug("chdir(%s) = %d"% (relative_path, regreturn))
else:
Expand Down
0