“Finding all the code in a given binary is equivalent to the Halting problem.” Really?

前端 未结 4 798
野性不改
野性不改 2021-01-02 05:07

Was just reading the highly voted question regarding Emulators and the statement

It\'s been proven that finding all the code in a given binary is e

4条回答
  •  执念已碎
    2021-01-02 05:26

    I disagree with larsman.

    The halting problem says that no program P exists that can take any program and decide whether that program executes the halt instruction. Let me quote wikipedia:

    Alan Turing proved in 1936 that a general algorithm to solve the halting problem for all possible program-input pairs cannot exist. We say that the halting problem is undecidable over Turing machines.

    On the other hand we're not trying to make such program/algorithm, but we're trying to find all the code in this/these specific program(s). If we reverse-engineer the program and see that it immediately calls exit() (very optimistic example situation) we have proven that it will call halt, while it was impossible?!

    If we we're trying to build an emulator that can run any program we would fail since then you can (easily) reduce that to the Halting problem. But usually you are building an emulator for something like a Game Boy which supports a finite amount of game cartridges (programs) and thus it is possible.

提交回复
热议问题