From 6365dc2863885da7c37a741d90fbd9888b788f3d Mon Sep 17 00:00:00 2001 From: INSUN PYO Date: Mon, 2 Jul 2018 16:13:08 +0900 Subject: [PATCH] Move mount namespace logic from systemd-user-helper code to systemd service file. Signed-off-by: INSUN PYO Change-Id: Ia0fccee5f243a12de5f902641ccb855e6daa7909 --- src/systemd-user-helper/systemd-user-helper.c | 36 ------------------- units/session-utils.conf | 2 ++ 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/src/systemd-user-helper/systemd-user-helper.c b/src/systemd-user-helper/systemd-user-helper.c index 60dc3e1..f3686e0 100644 --- a/src/systemd-user-helper/systemd-user-helper.c +++ b/src/systemd-user-helper/systemd-user-helper.c @@ -74,16 +74,6 @@ static const char *systemd_arg[] = { NULL }; -int mac_smack_use(void) -{ - static int cached_use = -1; - - if (cached_use < 0) - cached_use = access("/sys/fs/smackfs/", F_OK) >= 0; - - return cached_use; -} - static int stop_process(char *username) { int r; @@ -100,25 +90,6 @@ static int stop_process(char *username) return 0; } -static int normal_user_preprocess(char *username) -{ - int r; - - r = unshare(CLONE_NEWNS); - if (r < 0) { - fprintf(stderr, "unshare failed\n"); - return r; - } - - r = mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL); - if (r < 0) { - fprintf(stderr, "Failed to change the propagation type of root to SLAVE\n"); - return r; - } - - return 0; -} - static int normal_user_postprocess(char *username) { int r; @@ -321,13 +292,6 @@ int main(int argc, char *argv[]) return -2; } - /* pre-processing */ - r = normal_user_preprocess(username); - if (r < 0) { - fprintf(stderr, "normal user preprocess failed\n"); - return r; - } - /* If container supports below funcs, below line should be enabled. */ support_container = (access(CONTAINER_LIB, F_OK) == 0) ? 1 : 0; if (support_container) { diff --git a/units/session-utils.conf b/units/session-utils.conf index 1abc837..291ef1b 100644 --- a/units/session-utils.conf +++ b/units/session-utils.conf @@ -6,3 +6,5 @@ ExecStart=/usr/bin/systemd-user-helper start %i ExecStop=/usr/bin/systemd-user-helper stop %i PIDFile=/run/user/%i/.systemd.pid + +MountFlags=slave -- 2.34.1