[panda-users] osi_linux infinite loop

Manolis Stamatogiannakis mstamat at gmail.com
Tue Aug 14 19:49:24 EDT 2018


I'm trying to have osi_linux run with ubuntu-16.04, i386. My kernel offsets
seem to work so far and I can see process names, pids etc. However,
occasionally run into an infinite loop. My code runs on the asid_changed
event. See the OSI_PROC_EVENTS block inside os_intro.c.

After investigating, it seems that the infinite loop triggers always for
the systemd-cgroups process, with different pid every time. I would guess
that this process acts only as a launcher. So, at the time when the
asid_changed callbacks are run, the process is about to exit and has
already been unlinked from the process list.

When the infinite loops occur, the starting task_struct in
on_get_processes() corresponds either to a non-threaded process or a
non-leader thread.

I can avoid the infinite loop by always starting the process enumeration
from the next process of the thread group leader.

In theory (as depicted in kernel_structs.html) simply following the next
process pointer would be adequate. However this does not resolve the
infinite loops in the case where the starting task_struct is a non-leader
thread.

I'm not sure what I'm missing here. Is this some implementation detail of
4.x we're missing? (I can't recall observing this with 3.x) Or is this a
systemd-specific behaviour that didn't manifest with pre-systemd distros?

I will submit a PR with the fix avoiding the infinite loop. However this
may break any plugins that make assumptions on the order of processes as
returned by get_processes().

Any hints or feedback is welcome. I will follow up with the replay and
instructions to reproduce the infinite loops.

Thanks in advance,
Manolis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/panda-users/attachments/20180814/4d991629/attachment.html


More information about the panda-users mailing list