158 questions
4
votes
1
answer
204
views
On x86-64 can aligned writes to *code* be assumed to be read atomically by other cores?
I'm investigating the possibility of cross-modifying (hotpatching) code without pausing other threads.
The Intel and AMD manuals specifically document that aligned writes to memory of 1, 2, 4 or 8 ...
0
votes
1
answer
125
views
On x86-64 if you modify code at runtime and don't flush the icache, can the old code run indefinitely? [duplicate]
There is a lot of documentation online suggesting that when you modify code at runtime that you should flush the instruction cache. However, it's unclear how much this is about making sure the old ...
-1
votes
1
answer
374
views
Writing a Self modifying code at runtime in C/C++ [duplicate]
i have some questions,
is possible to make a programm in windows that modify itself?
i write this program that use the _asm{} function:
#include <iostream>
using namespace std;
void print() //...
1
vote
2
answers
150
views
How to sum elements of an array only with direct addressing?
Suppose we have an array of 100 numbers. I saw a question about this here but didn't understand how to solve the problem. These are the instructions we have:
Instruction
Meaning
mov addr1,addr2
Maddr1 ...
-5
votes
1
answer
167
views
how to make a programme modify itself on running in c
i have a simple programme that shuts down a computer but it always gets detected as a virus when i share the exe file so i was wondering if i could make the programme treat a part of the code like a ...
0
votes
0
answers
380
views
How can I write self-modifying code on Windows?
When I was learning to program in assembler on a DOS system - the program could change its own code while the program was running and see it in the debugger. For some reason it doesn't work on Windows....
0
votes
2
answers
161
views
Using strreplace with variables against running script?
Update:
A lot of progress was made to the ini result and the self-editing-code result; however, only the functions that make the edits are finished, not the gui/implementation. Will add more soon.
My ...
1
vote
1
answer
266
views
Get the address of an intrinsic function-generated instruction
I have a function that uses the compiler intrinsic __movsq to copy some data from a global buffer into another global buffer upon every call of the function. I'm trying to nop out those instructions ...
0
votes
1
answer
56
views
Modifiying the linux system kernel
i want to modify the system kernell for linux, i want to change the open system call, so when i try to open one file, i want to open another one, but i cannot find where in the open.c file this can be ...
0
votes
1
answer
368
views
Accesing 2 items in a list and store it as the variable first_two
I want to access the first two items in the list and change it to the variable "first_two" but i can't find my mistake, please help.
Color_list = ["red", "blue", "...
3
votes
1
answer
220
views
Is it safe to write unaligned to an immediate operand in machine code while that code is executing?
Let's say I have x86-64 code that looks like this (though this question applies more generally to all code):
mov rbx,7F0140E5247Dh
jmp rbx
Is it safe to overwrite the target constant if that target ...
0
votes
0
answers
34
views
Implement self-modification in the fork()
In fork, the parent and child share the code, so if I modify the code content in the child (for example, by self-modifying), can the parent execute the modified content when it reaches the ...
0
votes
0
answers
44
views
Self-modifying code does not work under advanced optimization
I tried to write a self-modifying code. (Refer to the link https://shanetully.com/2013/12/writing-a-self-mutating-x86_64-c-program/) The self-modifying code works when there is no optimization (-o0)
...
-1
votes
1
answer
211
views
In self-modifying code, how to get the actual running address of the byte to be modified ?
In the example of self-modifying code, you can use the function name as a label to get the actual address of the program, plus the offset of the byte to be modified, and then get the actual address of ...
4
votes
1
answer
3k
views
Synchronizing caches for JIT/self-modifying code on ARM
The general, more abstract procedure for writing and later executing JIT or self-modifying code is, to my understanding, something like the following.
Write the generated code,
make sure it's flushed ...