-
Notifications
You must be signed in to change notification settings - Fork 749
Fix Unix socket subsystem #1181
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
Conversation
Getting ready for 1.4.3
Dirty fix
Remove `buf` decoding with `utf-8` encoding due to possible errors
Add support for the abstract socket namespace
Remove leading null bytes from the path
Add `ql_unix_socket_path` for the `AF_UNIX`
`ino64_t` and `off64_t` are `unsigned long long` - not pointers
Add Unix abstract namespace handling
Merge fixes
qiling/os/posix/syscall/unistd.py
Outdated
regreturn = 0 | ||
# TODO: according to real implementation, idk why here was a FIFO check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I track the history for this code. Looks like it's introduced here: 2f6ff43. Thus, it should be safe to remove the comments totatly.
qiling/os/posix/syscall/unistd.py
Outdated
@@ -732,7 +734,7 @@ def _type_mapping(ent): | |||
return bytes([t]) | |||
|
|||
if ql.os.fd[fd].tell() == 0: | |||
n = ql.arch.pointersize | |||
large_field_size = 8 if is_64 else 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this is correct? According to the existing implementation n
is set by the arch native pointer size, while is_64
indicates whether this function was called from ql_syscall_getdents
or ql_syscall_getdents64
- not necessarily the arch bits.
I don't know if these are equivalent, and from the existing implementation it appears that they are not.
For example, ql_syscall_getdents64
may be called in a 32 bits environment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, large_field_size
( ino64_t
and off64_t
) is unsigned long long
on x64 - not pointers, so the size of the structure linux_dirent64
does not depends on the architecture, but the initial implementation relies on the pointer size.
Looks like during the
|
That aligns with my assumption that |
The cause of changing the implementation was a problem in the emulation of Android Armv7 binaries, where |
Unless a malware sample, the binaries should be pretty standard so I'd assume they work properly. It's worth checking whether Android behaves differently than other POSIX here; if it does, then this method may be implemented specifically for Android: OS-specific syscalls implementation takes precesence over global POSIX syscalls'. |
There was a problem hiding this comment.
Choose a reas 8000 on for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Once CI is green, we are safe to go! |
Which kind of PR do you create?
Coding convention?
Extra tests?
Changelog?
Target branch?
One last thing