[panda-users] OSI plugin issues

Brendan Dolan-Gavitt brendandg at gatech.edu
Wed Aug 12 15:47:07 EDT 2015


Not sure about user-mode. In kernel-mode, from a quick peek at the
source, it seems that they dedicate an entire register ($28) to hold
the pointer to the currently executing thread:

http://lxr.free-electrons.com/source/arch/mips/include/asm/thread_info.h#L56

And from there you can get to the current task_struct & PID.

Also, last I checked, our record/replay wasn't working on MIPS,
because QEMU's savevm/loadvm are broken.

-Brendan

On Wed, Aug 12, 2015 at 3:30 PM, Igor R <boost.lists at gmail.com> wrote:
>> A (slow) workaround that could be implemented relatively easily would be:
>>
>> In on_get_current_process(), check if guest is in kernel mode.
>>
>> If it is, use the existing code (faster).
>> If not, then start traversing the task list, starting from the init task
>> (its address is extracted by the kernelinfo module). In each iteration:
>>
>> Get the asid of the task using get_pgd(env, current_task_addr).
>> This asid will be a virtual address. Translate it to physical using
>> panda_virt_to_phys(env, asid).
>> If the physical address equals the current PGD, then break - you found the
>> running task. You can fill the process details in the struct and return.
>
>
> Coming back to this issue...
> I would like implement a similar algorithm on MIPS (Linux).
> It seems however that it's quite not trivial to get the "current pgd"
> (i.e. the pointer to the translation table of the current process) on
> MIPS. But maybe there are other, MIPS-specific, ways to get the
> current pid/task_struct in user-mode?
> (Actually, I'm doing that on the upstream QEMU, so it's not quite
> PANDA question, but perhaps the experts reading this list could shed
> some light on this problem.)
>
> Thanks!
> _______________________________________________
> panda-users mailing list
> panda-users at mit.edu
> http://mailman.mit.edu/mailman/listinfo/panda-users


More information about the panda-users mailing list