lmkd: fix handling of EPOLLHUP for pidfd
Recent kernel change [1] cause pidfd_wait() to receive EPOLLHUP when the task exits. Current LMKD implementation expects to receive EPOLLHUP only when socket connection gets dropped, therefore it gets confused by this new kernel behavior. Adjust LMKD handling of EPOLLHUP to detect the case when this event is generated by pidfd. [1] https://lore.kernel.org/all/20240202131226.GA26018@redhat.com/ Bug: 352286227 Change-Id: Ibcf349ee3cc73551541d64975f0292d53c41d5c2 Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
parent
1683221f0d
commit
667fdbfe92
6
lmkd.cpp
6
lmkd.cpp
|
|
@ -3911,13 +3911,17 @@ static void mainloop(void) {
|
||||||
*/
|
*/
|
||||||
for (i = 0, evt = &events[0]; i < nevents; ++i, evt++) {
|
for (i = 0, evt = &events[0]; i < nevents; ++i, evt++) {
|
||||||
if ((evt->events & EPOLLHUP) && evt->data.ptr) {
|
if ((evt->events & EPOLLHUP) && evt->data.ptr) {
|
||||||
ALOGI("lmkd data connection dropped");
|
|
||||||
handler_info = (struct event_handler_info*)evt->data.ptr;
|
handler_info = (struct event_handler_info*)evt->data.ptr;
|
||||||
|
if (handler_info->handler == kill_done_handler) {
|
||||||
|
call_handler(handler_info, &poll_params, evt->events);
|
||||||
|
} else {
|
||||||
|
ALOGI("lmkd data connection dropped");
|
||||||
watchdog.start();
|
watchdog.start();
|
||||||
ctrl_data_close(handler_info->data);
|
ctrl_data_close(handler_info->data);
|
||||||
watchdog.stop();
|
watchdog.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Second pass to handle all other events */
|
/* Second pass to handle all other events */
|
||||||
for (i = 0, evt = &events[0]; i < nevents; ++i, evt++) {
|
for (i = 0, evt = &events[0]; i < nevents; ++i, evt++) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue