What does HackerNews think of movfuscator?

The single instruction C compiler

Language: C

Reminded me of the movsfucator that compiles programs into only mov instructions!

https://github.com/xoreaxeaxeax/movfuscator

And also REpsych from the same developer which really isn't for the fainthearted...

https://github.com/xoreaxeaxeax/REpsych

The MOV-only CPU [1, 2] is probably about as close to this as you can get. If you think about it, every structured programming affordance is sugar for writing a state machine. MOV-only pushes all control flow into a state machine, and does so without using any branches itself. It's all MOVs all the time.

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

[2] https://harrisonwl.github.io/assets/courses/malware/spring20...

A similarly funny x86 project compiles programs only to "MOV" instructions. It's very much Turing complete.

https://github.com/xoreaxeaxeax/movfuscator

Reminds me somewhat of the C complier that only emits MOV instructions: https://github.com/xoreaxeaxeax/movfuscator
This is up there with the scariest piece of software in existence:

https://github.com/xoreaxeaxeax/movfuscator

Presentation of idea:

https://m.youtube.com/watch?v=R7EEoWg6Ekk

Slightly offtopic sorry, but I remember seeing this project years ago for a compiler that emits only mov instructions:

https://github.com/xoreaxeaxeax/movfuscator

Since this is effectively branchless and every instruction would take the same number of micro ops, wouldn't this be a very safe way of writing cryptographic code free of side channels?

Someone wrote a C compiler that generates code using only x86 MOV instructs.

https://github.com/xoreaxeaxeax/movfuscator

I share a similar belief . I think we can have physics like discussion for money . where joule ~ money and joule / sec ~ value , i am making a distinction between money and value where money is more discrete(quantized) and value is continuous . The second secret ingredient is compute. OP(like FLOP) ~ money and OPS ~ value . putting it together we get , M = OP * E * K where OP -> total no of operations E -> energy spent K -> some constant . Dimensionally money has same SI unit as Joule , Total operation is a dimensionless variable . V = M / T {having same SI unit as Watt} value is money per unit time and Goverments / services / business should be seen as value generators the same way we describe the power of an engine as horsepower or watts . This model is completely different than market analysis of prices / value . Not to mention that majority of value traded is done outside of open markets .

This model makes the assumption that all players in the value chain (producers and consumers) are agents with repeatable instructions ie put,Get,push,add,mov,etc.

Since there is No SI unit for instructions I propose the Unit for measuring instructions be MOV operator , This is because of my belief taking inspiration from the X86 MOV operator which was proven to be turing complete with the movfuscator(https://github.com/xoreaxeaxeax/movfuscator). What this means IMO all computable operations can be broken down to move operations.

Lastly this system views markets as interaction between agents . And makes the assumption that agents that do not sustainably price their goods / services will fail to operate in the longrun. And views variance / volatility in prices as a outcome of chaotic interaction between agents rather True indicator of value.

i think we can have physics like discussion for money . where joule ~ money and joule / sec ~ value , i am making a distinction between money and value where money is more discrete(quantized) and value is continuous . The second secret ingredient is compute. OP(like FLOP) ~ money and OPS ~ value . putting it together we get , M = OP * E * K where OP -> total no of operations E -> energy spent K -> some constant . Dimensionally money has same SI unit as Joule , Total operation is a dimensionless variable . V = M / T {having same SI unit as Watt} value is money per unit time and Goverments / services / business should be seen as value generators the same way we describe the power of an engine as horsepower or watts .

This model is completely different than market analysis of prices / value . Not to mention that majority of value traded is done outside of open markets .

This model makes the assumption that all players in the value chain (producers and consumers) are agents with repeatable instructions ie put,Get,push,add,mov,etc.

Since there is No SI unit for instructions I propose the Unit for measuring instructions be MOV operator , This is because of my belief taking inspiration from the X86 MOV operator which was proven to be turing complete with the movfuscator(https://github.com/xoreaxeaxeax/movfuscator). What this means IMO all computable operations can be broken down to move operations.

Lastly this system views markets as interaction between agents . And makes the assumption that agents that do not sustainably price their goods / services will fail to operate in the longrun. And views variance / volatility in prices as a outcome of chaotic interaction between agents rather True indicator of value.

Why ‘if’ and ‘goto’, all you need is « mov » https://github.com/xoreaxeaxeax/movfuscator ;)

Structured programming is not just a syntax sugar: the restriction encourages more readable programs https://blog.acolyer.org/2016/10/13/go-to-statement-consider...

Avoiding jmp in assembly is a sensible thing to do. jmp may stall the pipeline if the branch predictor is wrong. Better to use cmov when you can.

And if we're being silly, you only really need mov[1].

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

It's particularly bad with x86 due to the enormous variety of encodings and prefixes accumulated over the last half-century in the architecture. For example, the two instructions:

  mov rax, [table + rax*8] 
  mov [table + rax*8], rax
plus some lookup tables make a Turing-complete subset: https://drwho.virtadpt.net/files/mov.pdf (With jumping via conditional faulting done with an invalid MOV, of course.) There are many other subsets. And even C compilers targeting them: https://github.com/xoreaxeaxeax/movfuscator

Even better, there are multiple encodings of those instructions. And even better than that, there are Turing-complete subsets comprised only of printable ASCII characters. And even better than that, there are subsets of x86 the instruction set that can masquerade as readable English text: https://news.ycombinator.com/item?id=16312317

If your program counter ever diverges off to start executing unsanitized user data on x86, you are potentially pwn'd.

The following might be of interest:

movfuscator

"The single instruction C compiler"

https://github.com/xoreaxeaxeax/movfuscator

...In other words, yes, it is possible to write a complete compiler which creates all of its compiled code by using only one single type of x86 instruction...

Also, this might be interesting:

https://en.wikipedia.org/wiki/One-instruction_set_computer

>"A one-instruction set computer (OISC), sometimes called an ultimate reduced instruction set computer (URISC), is an abstract machine that uses only one instruction – obviating the need for a machine language opcode.[1][2][3] With a judicious choice for the single instruction and given infinite resources, an OISC is capable of being a universal computer in the same manner as traditional computers that have multiple instructions.[2]:55 OISCs have been recommended as aids in teaching computer architecture[1]:327[2]:2 and have been used as computational models in structural computing research.[3]"

Unless you compile your program with movfuscator: https://github.com/xoreaxeaxeax/movfuscator

Or you decide to execute code on The Fungus: https://www.bedroomlan.org/hardware/fungus

I also recall reading a paper that got into implementing a GC on silicon for a graph rewriting based architecture

WebAssembly is if/else blocks. There's a potential future where it gets implemented directly as a CPU ISA (albeit it'd likely involve some dynamic translation, but the CPU may decide to have SSA as its internal representation)

It's important to understand there's a real distinction between semantics & implementation. Otherwise you risk emulating your implementation when some new hardware comes out (say GPUs, or Quantum computers, or out of order CPUs working backwards to create something like SSA for register renaming/pipelining, or cmov)

See also the debates over C code being executed in the C abstract machine for optimizers while programmers rely on implementation of the end result. But in a language without undefined / implementation-defined behavior you won't have these ways of having the program self observe its implementation

Have you ever encountered any DRM using M/o/Vfuscator (compiler that only produces mov instructions) or REpsych (psychological warfare against reverse engineers)? The DEF CON talk about REpsych is pretty hilarious and worth watching.

https://github.com/xoreaxeaxeax/movfuscator https://github.com/xoreaxeaxeax/REpsych

These are classified as "libc things". When using mov you can still access libc like any other program. Go study movfuscator(which I linked again) if you would like a full understanding[0]. When you have to interface C with a not-very-Unixy system like Webassembly or these mainframes, you have to link to a compatible libc that remaps everything appropriately.

Malloc isn't particularly more special than any libc function. It simply supports the fantasy that the memory is unlimited in scale. It was always of a static size, you were just handing off the chore of dividing it up. You can usefully implement dynamic sizing in languages with static memory allocation by pre-allocating large arrays and then maintaining handles and liveness flags. This is, in fact, how every console game used to do it until available memory sizes got into the hundreds of megabytes. Fragmentation and the subsequent crashes from OOM presented too much of a concern before then.

[0] https://github.com/xoreaxeaxeax/movfuscator