《黑客:剥削的艺术》- 书籍示例与我系统的 gcc 中的程序集不一致 [英] "Hacking: The Art of Exploitation" - Assembly Inconsistencies in book examples vs. my system's gcc

查看:24
本文介绍了《黑客:剥削的艺术》- 书籍示例与我系统的 gcc 中的程序集不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 黑客:剥削的艺术".我正在尝试遵循代码示例,但由于某种原因,汇编代码根本与我实际 Linux 上的代码不匹配(在 Virtual Box 上作为访客运行).我已经确定我已经安装了 32 位 Linux 操作系统.是否有任何 args 可以传递给 gcc,让我将代码编译成与书中给出的非常匹配的程序集?

I am studying "Hacking: The Art of Exploitation". I am trying to follow the code examples, but for some reason the assembly codes simply does not match the one on my actual Linux (running on Virtual Box as Guest). I have made sure that I have installed 32 bit Linux OS. Is there any args that I can pass to gcc that lets me compile the code into an assembly that matches closely with the ones given in the book?

我会很好地协调这本书和这本书之间的代码差异.如果它们是次要的,我会看到什么,但我看到的差异是明显的.我不知何故不喜欢从预配置的孵化器环境"运行代码.因为这会阻碍我的技能发展.

I would be fine reconciling the code differences between the book & what I see if they were minor, but the difference I see is stark. I somehow don't like to run the code from the "Preconfigured incubator environment" as this inhibits my skill development.

推荐答案

由于某种原因,汇编代码根本与我实际 linux 上的不匹配

for some reason the assembly codes simply does not match the one on my actual linux

最可能的原因是该书于 2008 年出版,并使用了当时稳定的 GCC(您可以查看 GCC 发布历史这里).

The most likely reason is that the book was published in 2008, and used then-stable GCC (you can see GCC release history here).

您现在使用的 GCC 可能更新很多,因此会生成截然不同(希望更好)的代码.

GCC that you are using now is likely much newer, and so generates significantly different (and one hopes better) code.

是否有任何 args 可以传递给 gcc,让我将代码编译成与书中给出的非常匹配的程序集?

Is there any args that I can pass to gcc that lets me compile the code into an assembly that matches closely with the ones given in the book?

没有.您可以尝试编译和安装 2008 年的版本,可能是 4.2.3 或 4.3.0,然后检查是否可以提供更接近的输出.

No. You can try to compile and install a version from 2008, perhaps 4.2.3 or 4.3.0, and check whether that gives you closer output.

附:看起来这本书的第一次修订是从 2003 年开始的,而且作者不太可能为 2008 年的第二版重建所有示例,所以也许可以试试 GCC 3.3?

P.S. It looks like the first revision of the book is from 2003, and it's unlikely that the authors rebuilt all of their examples for the second edition in 2008, so perhaps try GCC 3.3 instead?

这篇关于《黑客:剥削的艺术》- 书籍示例与我系统的 gcc 中的程序集不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆