Live data from Hacker News

M/o/Vfuscator: A single instruction C compiler

github.com

1–10 of 30 posts

Re: M/o/Vfuscator: A single instruction C compiler

#4
post #3

Branching with only MOV? How does that work? Is there no actual flow control but instead conditional manipulation (MOVs) of values?

It depends on x86 addressing modes, but tldr lookup tables:

> mov eax, [base + eax*4]

You load 1 address if eax is 0 and a different on if it’s 1. There’s also a jump instruction so you can implement a conditional jump through mov.

This is based on the Stephen Dolan paper: https://harrisonwl.github.io/assets/courses/malware/spring20...

Re: M/o/Vfuscator: A single instruction C compiler

#5
post #3

Branching with only MOV? How does that work? Is there no actual flow control but instead conditional manipulation (MOVs) of values?

There can be control flow. MOV an address into the right spot in the interrupt vector table then do a MOV that causes a fault that calls the right interrupt (such as a page fault).

Re: M/o/Vfuscator: A single instruction C compiler

#7
For anyone else who immediately thought, "I've gotta try that!" and hit compilation errors: there appears to be a more maintained fork at [0].

And if you're on a 64-bit system, you'll want to make sure it finds the 32-bit libc and libm binaries (see [1]). On Arch, the following worked for me:

    ./build/movcc -L/usr/lib32 test.c
[0]: https://github.com/xoreaxeaxeax/movfuscator

[1]: https://github.com/xoreaxeaxeax/movfuscator/issues/39

Re: M/o/Vfuscator: A single instruction C compiler

#8
If you haven't seen it, the original conference talk on the Movfuscator is excellent – https://www.youtube.com/watch?v=R7EEoWg6Ekk – it goes through it in detail and describes how version 0.0 had Brainfuck as a totally legitimately valid intermediate language ;-)

Re: M/o/Vfuscator: A single instruction C compiler

#9
post #2

Previous discussion: May 19, 2021 - https://news.ycombinator.com/item?id=27202801 (40 comments)

"It is well-known that the x86 instruction set is baroque, overcomplicated, and redundantly redundant. We show just how much fluff it has by demonstrating that it remains Turing-complete when reduced to just one instruction." – MOV is Turing-complete, Stephen Dolan, 2013

discussion (2013) https://news.ycombinator.com/item?id=6309631

[While I concur that x86 MOV is impressively powerful, it is also well-known that simple NAND gates can be combined to compute arbitrary logic functions. There are also many simple single instruction/operation CPU designs.]

Post reply on HN