From 9d0812ce40cc6509dd24e650c9947abcec8172bb Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 7 Aug 2020 14:49:08 +0900 Subject: [PATCH] Fix client pid check If the loader context is a hydra loader, launchpad doesn't check the client process ID. The child process of the hydra loader tries to connect to the launchpad-process-pool. If launchpad rejects the request, the child process of the hydra loader will be terminated. Change-Id: If4898ba64acb75f647086e266289a669f83673d5 Signed-off-by: Hwankyu Jhun --- src/launchpad/src/launchpad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/launchpad/src/launchpad.c b/src/launchpad/src/launchpad.c index 6e9864d..804aa23 100644 --- a/src/launchpad/src/launchpad.c +++ b/src/launchpad/src/launchpad.c @@ -629,7 +629,7 @@ static int __accept_candidate_process(int server_fd, int *out_client_fd, goto error; } - if (cred.pid != cpc_pid) { + if (cpc_pid != -1 && cred.pid != cpc_pid) { _E("Invalid accept. pid(%d)", cred.pid); goto error; } @@ -1449,7 +1449,7 @@ static bool __handle_loader_event(int fd, io_condition_e cond, void *data) if (!cpc->prepared) { ret = __accept_candidate_process(fd, &client_fd, &client_pid, - cpc->pid); + cpc->is_hydra ? -1 : cpc->pid); if (ret >= 0) { /* for hydra need to set pid to pid of non-hydra candidate, */ /* which is connecting now */ -- 2.7.4