From e16bcd08aae85a7d9c2de5a4b1c733280cb81112 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sun, 13 May 2018 00:08:52 +0200 Subject: Remove MOZ_WIDGET_GONK [2/2] Tag #288 --- ipc/chromium/src/base/process_util_linux.cc | 45 ++--------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) (limited to 'ipc/chromium/src/base/process_util_linux.cc') diff --git a/ipc/chromium/src/base/process_util_linux.cc b/ipc/chromium/src/base/process_util_linux.cc index 204017db5..57388ccb0 100644 --- a/ipc/chromium/src/base/process_util_linux.cc +++ b/ipc/chromium/src/base/process_util_linux.cc @@ -24,24 +24,13 @@ #include "prenv.h" #include "prmem.h" -#ifdef MOZ_WIDGET_GONK /* - * AID_APP is the first application UID used by Android. We're using - * it as our unprivilegied UID. This ensure the UID used is not - * shared with any other processes than our own childs. - */ -# include -# define CHILD_UNPRIVILEGED_UID AID_APP -# define CHILD_UNPRIVILEGED_GID AID_APP -#else -/* - * On platforms that are not gonk based, we fall back to an arbitrary - * UID. This is generally the UID for user `nobody', albeit it is not + * On our platforms we use an arbitrary UID. + * This is generally the UID for user `nobody', albeit it is not * always the case. */ # define CHILD_UNPRIVILEGED_UID 65534 # define CHILD_UNPRIVILEGED_GID 65534 -#endif namespace { @@ -229,36 +218,6 @@ void SetCurrentProcessPrivileges(ChildPrivileges privs) { gid_t gid = CHILD_UNPRIVILEGED_GID; uid_t uid = CHILD_UNPRIVILEGED_UID; -#ifdef MOZ_WIDGET_GONK - { - static bool checked_pix_max, pix_max_ok; - if (!checked_pix_max) { - checked_pix_max = true; - int fd = open("/proc/sys/kernel/pid_max", O_CLOEXEC | O_RDONLY); - if (fd < 0) { - DLOG(ERROR) << "Failed to open pid_max"; - _exit(127); - } - char buf[PATH_MAX]; - ssize_t len = read(fd, buf, sizeof(buf) - 1); - close(fd); - if (len < 0) { - DLOG(ERROR) << "Failed to read pid_max"; - _exit(127); - } - buf[len] = '\0'; - int pid_max = atoi(buf); - pix_max_ok = - (pid_max + CHILD_UNPRIVILEGED_UID > CHILD_UNPRIVILEGED_UID); - } - if (!pix_max_ok) { - DLOG(ERROR) << "Can't safely get unique uid/gid"; - _exit(127); - } - gid += getpid(); - uid += getpid(); - } -#endif if (setgid(gid) != 0) { DLOG(ERROR) << "FAILED TO setgid() CHILD PROCESS"; _exit(127); -- cgit v1.2.3