Gah, I just remembered I still need to finish my kernel patch to allow for the mmaping of /proc/[PID]/mem
You don't really need to know why I needed that to understand why it's an awful idea, but that's not going to stop me.
@kurisu So I've got this fun little ffi-like library I've written that lets you call any function in memory as long as you know the address and have a general idea of its parameters.
So like `callf(0x07FEEDBEF, "%s%d", "Hello World", 1337)` right?
Well, it occurred to me that using that, I could map any arbitrary process memory into mine as a host and just kinda make use of its internals while it's running.
@kurisu Yeah, there is no doubt a lot of issues with it, and with some clever trickery it'd be possible to align everything properly.
I just thought it'd be a fun side experiment, not like It'd be useful for anything or I'd push the patch upstream.
@kurisu you can cast it to a function pointer but you need to know the signature of the function at compile time in that case.
callf was designed not for a REPL per-say but to not need any compile time information about the target being called, it's all runtime.
This includes spitting out the proper machine code at runtime to handle the call.
@kurisu The only way to get it to work as flexibly as I want is to write it on the fly. (well, not the *only* way, but it's more fun this way)
@kurisu Well, it depends on the calling convention and ABI among other things, while it's possible to do it all statically with some boilerplate asm that wouldn't be as much fun.
@kurisu I mean, that was an example, you could pull everything from stdin if you *really* wanted to.
Eh, it's just fun.
Welcome to your niu world ! We are a cute and loving international community Ｏ(≧▽≦)Ｏ !