mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 18:07:57 +00:00
Some ABIs allow functions to store data in caller frame, which means that we have to allocate an initial stack frame before executing code on the parasite stack. This test saves the contents of writable memory that follows the stack after the victim has been infected but before we start using the parasite stack. It later checks that the saved data matches the current contents of the two memory areas. This is done while the victim is halted so we expect a match unless executing parasite code caused memory corruption. The test doesn't detect cases where we corrupted memory by writing the same value. Signed-off-by: Younes Manton <ymanton@ca.ibm.com>
17 lines
202 B
C
17 lines
202 B
C
#include <unistd.h>
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int i;
|
|
|
|
while (1) {
|
|
if (read(0, &i, sizeof(i)) != sizeof(i))
|
|
break;
|
|
|
|
if (write(1, &i, sizeof(i)) != sizeof(i))
|
|
break;
|
|
}
|
|
|
|
return 0;
|
|
}
|