I want a simple C method to be able to run hex bytecode on a Linux 64 bit machine. Here\'s the C program that I have:
char code[] = \"\\x48\\x31\\xc0\";
#in
Your machine code may be all right, but your CPU objects.
Modern CPUs manage memory in segments. In normal operation, the operating system loads a new program into a program-text segment and sets up a stack in a data segment. The operating system tells the CPU never to run code in a data segment. Your code is in code[]
, in a data segment. Thus the segfault.