如何解释 ncval 的输出?
我正在尝试将一些软件移植到本机客户端。出于速度原因,它在代码中的多个位置使用一些内联汇编。 (它们中的大多数都是非常简单的一行代码,它们非常简单,应该被认为是安全的。)
我让项目进行编译和链接,但目前它无法通过 Chrome 的代码分析。 Ncval 输出以下内容:
segment[0] p_type 6 p_offset 0 vaddr 0 paddr 0 align 4
filesz b4 memsz b4 flags 4
segment[1] p_type 1 p_offset 10000 vaddr 20000 paddr 20000 align 65536
filesz 2e91a0 memsz 2e91a0 flags 5
parsing segment 1
VALIDATOR: 31be8: Illegal instruction
segment[2] p_type 1 p_offset 300000 vaddr 10020000 paddr 10020000 align 65536
filesz 72aac memsz 72aac flags 4
segment[3] p_type 1 p_offset 380000 vaddr 100a0000 paddr 100a0000 align 65536
filesz 1cb8 memsz 29658 flags 6
*** client_x86_32.nexe IS UNSAFE ***
Validated client_x86_32.nexe
*** client_x86_32.nexe is UNSAFE ***
但我真的不知道这个输出意味着什么。我可以看到它至少发现了一条非法指令。我做了 client_x86_32.nexe 的 objdump,我试图根据 ncval 的输出找出非法指令的地址,但我做不到,因为我不知道如何根据ncval 输出。
欢迎任何帮助。
(与此同时,我将开始从代码中删除 asm 块,并希望找到有问题的块,以便我可以更正它以确保安全。)
I am trying to port some software to native-client. It uses some inline asm at multiple locations in the code for speed reasons. (Most of them are really simple one-line ones, which are so simple that they should be considered safe.)
I got the project to compile and link, but at the moment it failes Chrome's code analysis. Ncval outputs the following:
segment[0] p_type 6 p_offset 0 vaddr 0 paddr 0 align 4
filesz b4 memsz b4 flags 4
segment[1] p_type 1 p_offset 10000 vaddr 20000 paddr 20000 align 65536
filesz 2e91a0 memsz 2e91a0 flags 5
parsing segment 1
VALIDATOR: 31be8: Illegal instruction
segment[2] p_type 1 p_offset 300000 vaddr 10020000 paddr 10020000 align 65536
filesz 72aac memsz 72aac flags 4
segment[3] p_type 1 p_offset 380000 vaddr 100a0000 paddr 100a0000 align 65536
filesz 1cb8 memsz 29658 flags 6
*** client_x86_32.nexe IS UNSAFE ***
Validated client_x86_32.nexe
*** client_x86_32.nexe is UNSAFE ***
But I don't really know what this output means. I can see that it found at least one illegal instruction. I did an objdump of client_x86_32.nexe, and I tried to figure out what the address of the illegal instruction(s?) is based on ncval's output, but I couldn't, because I don't know how to calculate it based on the ncval output.
Any help is welcome.
(In the meantime I will start removing asm blocks from the code, and hope I find the offending block, so that I can correct it to be safe.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
验证器的输出给出了代码地址 0x31be8。尝试在 client_x86_32.nexe 上使用 gdb 或 objdump 来查看地址 0x31be8 处有什么指令,并将其与您的 asm 块进行比较。
the validator's output gave the code address, 0x31be8. try using gdb or objdump on client_x86_32.nexe to see what instruction is at the address 0x31be8, and compare that with your asm blocks.