Unfork: The Inverse of Fork(2)
github.com
github.com
When I saw 'unfork' I thought 'someone found out how to replace the current process with a child process that was a older snapshot'. Any idea on how to do this? Like 'OK I did something wrong, let me back up a bit, kill me, replace me with my child x and refather every other one of my children processes to child x and gooo'.
Maybe something with ebpf in twelve years...
I know how to do snapshots of a process, what with criu. But if I just want a checkpoint to go back later, not a full serialization, and I don't want to save/restore a complete process, but take advantage of fork()'s CoW to save the least possible in a stopped process, then be able to come back. The rest of fork()' semantics are a problem, with threads, sockets, signals that are not passed down. An example of that approach is perf-fuzz where they add a new syscall to make fuzzing faster.
I should clarify my use case: I would use such a feature (go back to previous state) for a speculative execution tool. I'd execute the happy path all the time assuming no error occured, but if I found out later that something went wrong somewhere, I'd want to go back and start from there knowing what went wrong, and so on. With as little perf loss as possible. Not sure my explanation makes sense.
I know about dmtcp, criu, vm snapshots, but they all come with big overhead (I don't want to pay too much for the checkpoint).
The closest I found was @gamozolabs amazing work on snapshot fuzzing (pushing the limit of what's possible on x86_64 hardware, including using Intel PML - similar to userfaultfd but hw-accelerated...).
The recording overhead is quite acceptable, about 50%.
Rr also has a 'chaos mode' which changes the thread scheduling, and which greatly facilitates finding the 'unhappy' path.
The recording overhead is the same (it leverages rr) but you can explore your bug to your heart's content.
I mean look at that https://developers.redhat.com/blog/2018/10/22/introduction-t...
Amazing.
Thanks for the timetravelpdb link!
Your code made me think, maybe I'm tying myself into knots... But my thing is making hundred thousands of checkpoints so I'd have to have as many forks as savespoints. No way to coalesce parents, maybe reparenting could work there...
So... cheat development?
Coincidentally, the "manifesto" behind the bot invasion in Team Fortress 2: https://c-v.sh/unsownriddles
At first I thought that has to be straight trolling ("Educate yourself about GNU/Linux"!), but I'm not so sure it is: https://github.com/nullworks/cathook
Either way, deeply weird to put Linux (ehm, "GNU/Linux") into the headline of your cheat that's literally only designed to make a game unplayable (https://github.com/nullworks/cathook/issues/1480).
This is the sort of software smart people can use for fresh and novel things the designer never even intended.