English 中文(简体)
如果在集会计划中没有撤离制度,情况如何?
原标题:What happens if there is no exit system call in an assembly program?

在一项组装方案中,<代码>.text section isloaded at 0x08048000;.data and the .bss section were after that.

如果I don t.text部分进行扫描,将会出现什么情况? 这是否会导致<代码>.data和.bs节被解释为造成“无法预测”行为的行为的代码? 方案何时终止——很可能是在每处“破坏”执行之后?

我可以轻而易举地撰写一份没有<代码>exit 扫描的方案,但如果测试<代码>.data和.bs,则我不知道,因为我猜测我必须知道在座下产生的实际机码,以理解这一点。

我认为,这个问题比使用组装语言更多地涉及“本组织和万国邮联如何处理这种假想?”,但对于大会方案人员来说,了解情况仍然令人感兴趣。

最佳回答

加工商不知道贵方的法典为何要终止。 它忠实地执行了另一项指示,直至将执行转向其他地方(例如跳跃、打电话、打断、系统电话或类似)。

如果您的法典在不跳跃到别处的情况下结束,则处理员在你的法典之后继续执行任何记忆。 很难预测究竟会发生什么,但最终,你的代码通常会坠毁,因为它试图执行无效指示,或试图获得不允许的记忆。

If neither happens and no jump occurs, eventually the processor tries to execute unmapped memory or memory that is marked as “not executable” as code, causing a segmentation violation. On Linux, this raises a SIGSEGV or SIGBUS. When unhandled, these terminate your process and optionally produce core dumps.

如果你 re笑,就坐在一个夸张下,看看错失的指令。

问题回答

解决这一问题,见。 • 启动,以正确方式在32或64-bit x86代码中进行离开系统查询,以备对短链氯化石蜡或视窗进行查询。 (切入点,_start/code>, isn t a function inosphere; thepinack pointer points at argc, not a Return address, so ret/code> 没有工作。 对其他《国际审计准则》或顾问来说,检查其手册,或研究现有如何退出的实例。

另见。 退出系统的正确不变之处是什么?:#include <sys/sysert.h> in a .S file to have persistents such as SYS_exit(或SYS_exit_group)。

或可直接使用C头盔的组装机,可检索asm/unistd.h;关于x86-64诉-32,见unistd_64.hunistd_32.h。 (And/or see this Q&A, 用于制作.inc的仪器,从C Headers处取,但只用了固定号码,也有助于打上。 O_RDWR or _PRIVATE persistentsations args.


www.un.org/Depts/DGACM/index_spanish.htm 如果您重新利用任何校准职能,特别是f,请您在上填入<> > > 信号中流 buffer缓冲器。 或ret from main, not _start/code>, and Let the CRTstartup Code calls 。 另见《公约》第3条。


。 万国邮联不知道贵源的结束之处,它只是从记忆中 f和脱条。

通常在<代码>末尾处有点零的dding。 关于32-bit x86,00 00 decodes as add [eax],al, 添加一个记忆-点。 该编码为64个轨道。 如果俄罗斯宇宙航空研究开发机构没有点到一个可书写的网页,这将错过1

RISC-V specifically chose its opcodes so 00 00 00 00 (and 00 00 compressed instructions) would be invalid instructions that fault, definitely not a NOP, so regions of zero-padding can t work as NOP sleds for exploits send execution nearby instead of exactly to the bytes they want to execute. Some other RISCs do run all-zero bytes as a NOP or non-faulting ALU instruction.

If execution gets past whatever 00 or non-zero garbage bytes are in memory, eventually it ll come to an unmapped or non-executable page. This will also lead to an invalid page fault, just like a data access for a bad pointer, so you also get SIGSEGV on Unix-like systems.

(关于没有记忆保护的原始CPU的法令,教员可以总结。) e. 例如,在8086年,来自CS的代码表:IP包裹不影响CS,因此,在64Ki实施的暗中 lo。 B区域,如果它采用所有直线代码而不跳跃的话。

If you re curious, run under a debugger and look at disassembly of the faulting instruction, and the hexdump of its machine code in case you recognize it as ASCII data or 00 padding. (Don t put data in the path of execution either.)


Footnote 1: hardware #PF exception -> software SIGSEGV

The x86 CPU exception is #PF, a page fault. The CPU will run the kernel s page-fault handler, which checks whether the process should be allowed to access that virtual address.

如果是,它可以复制或分配新的一页,或只是将页码输入“wire”一页,从页数输入过程的地址空间、小卡或软页错。 或者,I/O要从磁盘(主要或硬页的过错)上接上页。

But in this case, we re talking about a page the process doesn t have mapped, so it s an invalid page fault. The kernel s page-fault handler will deliver a SIGSEGV segmentation-fault signal if this is a Unix-like OS, or do something similar for other OSes like Windows.

<代码>SIGSEGV信号的默认行动正在杀害你的工作,如果它没有为这一信号设立一位手。 你们不应这样做;除非你知道你的工作为何应当提升<条码>SIGSEGV,

请注意,由于现代,“围困过失”与CS和DS等x86部分没有关系 从事职业者使用假日保护记忆,而不是x86部分。 轨道或64-bit process on x86-030 运行,CS base=0 / limit=无限制。 这个名称是历史。





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签