gpt4 book ai didi

macos - 调试kext时读取用户空间地址address

转载 作者:行者123 更新时间:2023-12-04 05:41:45 25 4
gpt4 key购买 nike

当通过kdp 调试远程机器驱动程序(kext)时,我想从lldb 读取用户空间地址。我知道在代码中我可以使用 copyin 将代码移动到内核空间并轻松读取它,所以当我尝试直接读取用户内存时正如预期的那样它失败了:

(lldb) memory read 0x000070000d15a024
error: kdp read memory failed (error 4)

在运行时调试 session 期间是否有一些替代 copyin 的方法来将我的数据转换到我可以从调试器读取的位置?

谢谢

最佳答案

假设您为您使用的特定内核加载调试脚本(应该在适当的 KDK 中),您有 printuserdata 命令。

这是它的描述:

printuserdata:
Read userspace data for given task and print based on format provided.
Syntax: (lldb) printuserdata <task_t> <uspace_address> <format_specifier>
params:
<task_t> : pointer to task
<uspace_address> : address to user space memory
<format_specifier> : String representation for processing the data and printing it.
e.g Q -> unsigned long long, q -> long long, I -> unsigned int, i -> int
10i -> 10 ints, 20s -> 20 character string, s -> null terminated string
See: https://docs.python.org/2/library/struct.html#format-characters
options:
-X : print all values in hex.
-O <file path>: Save data to file

调用示例:

(lldb) printuserdata 0xffffff8013257d80 0x00007fff941f5000 10c

关于macos - 调试kext时读取用户空间地址address,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44388837/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com