[<prev] [next>] [day] [month] [year] [list]
Message-ID: <OF0BCEFABA.AA93B98E-ON48257C32.0031CD54-48257C32.00334133@zte.com.cn>
Date: Fri, 29 Nov 2013 17:19:21 +0800
From: zhang.yi20@....com.cn
To: Peter Zijlstra <peterz@...radead.org>
Cc: Tejun Heo <htejun@...il.com>, lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
Oleg Nesterov <oleg@...hat.com>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
pang.xunlei@....com.cn
Subject: [PATCH]: exec: avoid propagating PF_NO_SETAFFINITY into userspace child
Khelper is a workqueue thread which has PF_NO_SETAFFINITY set.
When a usermode process is spawned by khelper through __call_usermodehelper()
which will invoke kernel_thread() (not kthread_create()) to fork the new
process, we will clearly see that it will inherit the PF_NO_SETAFFINITY flag.
Consequently, this usermod process will lose some capabilities like
sched_setaffinity(), moving between cgroups, etc.
Clearing this flag in flush_old_exec() to solve this problem.
Signed-off-by: Zhang Yi <zhang.yi20@....com.cn>
Signed-off-by: Pang Xunlei <pang.xunlei@....com.cn>
--- linux-3.12.old/fs/exec.c 2013-11-26 08:53:12.175811856 +0000
+++ linux-3.12/fs/exec.c 2013-11-27 09:36:56.231972168 +0000
@@ -1090,8 +1090,8 @@ int flush_old_exec(struct linux_binprm *
bprm->mm = NULL; /* We're using it now */
set_fs(USER_DS);
- current->flags &=
- ~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD | PF_NOFREEZE);
+ current->flags &= ~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD |
+ PF_NOFREEZE | PF_NO_SETAFFINITY);
flush_thread();
current->personality &= ~bprm->per_clear;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists