move cred_guard_mutex from task_struct to signal_struct
From: KOSAKI Motohiro
Date: Sun Oct 24 2010 - 23:28:47 EST

    Next message: KOSAKI Motohiro: "[resend][PATCH 4/4] oom: don't ignore rss in nascent mm"
    Previous message: KOSAKI Motohiro: "[resend][PATCH 2/4] Revert "oom: deprecate oom_adj tunable""
    In reply to: David Rientjes: "Re: [resend][PATCH 2/4] Revert "oom: deprecate oom_adj tunable""
    Next in thread: Roland McGrath: "Re: [resend][PATCH 3/4] move cred_guard_mutex from task_struct to signal_struct"
    Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

Changelog
o since v1
- function comment also change current->cred_guard_mutex to
current->signal->cred_guard_mutex.

---------------------------------------------------------------------------
Oleg Nesterov pointed out we have to prevent multiple-threads-inside-exec
itself and we can reuse ->cred_guard_mutex for it. Yes, concurrent
execve() has no worth.

Let's move ->cred_guard_mutex from task_struct to signal_struct. It
naturally prevent multiple-threads-inside-exec.

Cc: stable@xxxxxxxxxx
Reviewed-by: Oleg Nesterov <oleg@xxxxxxxxxx>
Cc: Roland McGrath <roland@xxxxxxxxxx>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
---

And one more commit also present in the patch!
Fix Settings memory display issue
commit 81d60bc 1 parent 46b465db3c
dorimanx authored a day ago

======================
Showing 1 changed file with 21 additions and 0 deletions.
M 	kernel/fork.c 	21 .....
Txt kernel/fork.c

    View file @ 81d60bc

@@ -666,6 +666,27 @@ struct mm_struct *get_task_mm(struct task_struct *task)

 }

 EXPORT_SYMBOL_GPL(get_task_mm);

+struct mm_struct *mm_access(struct task_struct *task, unsigned int mode)

+{

+  struct mm_struct *mm;

+  int err;

+

+  err =  mutex_lock_killable(&task->signal->cred_guard_mutex);

+  if (err)

+    return ERR_PTR(err);

+

+  mm = get_task_mm(task);

+  if (mm && mm != current->mm &&

+      !ptrace_may_access(task, mode) &&

+      !capable(CAP_SYS_RESOURCE)) {

+    mmput(mm);

+    mm = ERR_PTR(-EACCES);

+  }

+  mutex_unlock(&task->signal->cred_guard_mutex);

+

+  return mm;

+}

+

 /* Please note the differences between mmput and mm_release.

  * mmput is called whenever we stop holding onto a mm_struct,

  * error success whatever.

Conflicts:
	arch/arm/boot/compressed/piggy.xzkern