[folded-merged] memcg-replace-mm-owner-with-mm-memcg-fix-2.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: memcg: close the race between migration and installing bprm->mm as mm
has been removed from the -mm tree.  Its filename was
     memcg-replace-mm-owner-with-mm-memcg-fix-2.patch

This patch was dropped because it was folded into memcg-replace-mm-owner-with-mm-memcg.patch

------------------------------------------------------
From: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
Subject: memcg: close the race between migration and installing bprm->mm as mm

Oleg pointed out that there is a race at exec time between when bprm->mm
is initialized and the exec'ing task being migrated to a different memory
control group.

Ractor the code in memcontrol so exec_mmap can use the same code as as
fork to ensure that task->memcg == task->mm->memcg.

Link: http://lkml.kernel.org/r/87fu37cow4.fsf_-_@xxxxxxxxxxxx
Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
Reported-by: Oleg Nesterov <oleg@xxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/exec.c                  |    2 ++
 include/linux/memcontrol.h |    5 +++++
 mm/memcontrol.c            |    4 ++--
 3 files changed, 9 insertions(+), 2 deletions(-)

diff -puN fs/exec.c~memcg-replace-mm-owner-with-mm-memcg-fix-2 fs/exec.c
--- a/fs/exec.c~memcg-replace-mm-owner-with-mm-memcg-fix-2
+++ a/fs/exec.c
@@ -1044,6 +1044,8 @@ static int exec_mmap(struct mm_struct *m
 		return 0;
 	}
 	mmdrop(active_mm);
+	/* The tsk may have migrated before the new mm was attached */
+	mm_sync_memcg_from_task(tsk);
 	return 0;
 }
 
diff -puN include/linux/memcontrol.h~memcg-replace-mm-owner-with-mm-memcg-fix-2 include/linux/memcontrol.h
--- a/include/linux/memcontrol.h~memcg-replace-mm-owner-with-mm-memcg-fix-2
+++ a/include/linux/memcontrol.h
@@ -408,6 +408,7 @@ static inline bool mem_cgroup_is_descend
 }
 
 void mm_update_memcg(struct mm_struct *mm, struct mem_cgroup *new);
+void mm_sync_memcg_from_task(struct task_struct *tsk);
 
 static inline bool mm_match_cgroup(struct mm_struct *mm,
 				   struct mem_cgroup *memcg)
@@ -792,6 +793,10 @@ static inline void mm_update_memcg(struc
 {
 }
 
+static inline void mm_sync_memcg_from_task(struct task_struct *tsk)
+{
+}
+
 static inline bool mm_match_cgroup(struct mm_struct *mm,
 		struct mem_cgroup *memcg)
 {
diff -puN mm/memcontrol.c~memcg-replace-mm-owner-with-mm-memcg-fix-2 mm/memcontrol.c
--- a/mm/memcontrol.c~memcg-replace-mm-owner-with-mm-memcg-fix-2
+++ a/mm/memcontrol.c
@@ -5086,7 +5086,7 @@ static void mem_cgroup_attach(struct cgr
 	}
 }
 
-static void mem_cgroup_fork(struct task_struct *tsk)
+void mm_sync_memcg_from_task(struct task_struct *tsk)
 {
 	struct cgroup_subsys_state *css;
 
@@ -5400,7 +5400,7 @@ struct cgroup_subsys memory_cgrp_subsys
 	.attach = mem_cgroup_attach,
 	.cancel_attach = mem_cgroup_cancel_attach,
 	.post_attach = mem_cgroup_move_task,
-	.fork = mem_cgroup_fork,
+	.fork = mm_sync_memcg_from_task,
 	.bind = mem_cgroup_bind,
 	.dfl_cftypes = memory_files,
 	.legacy_cftypes = mem_cgroup_legacy_files,
_

Patches currently in -mm which might be from ebiederm@xxxxxxxxxxxx are

memcg-replace-mm-owner-with-mm-memcg.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux