提交 793285fc 编写于 作者: O Oleg Nesterov 提交者: Linus Torvalds

cred_guard_mutex: do not return -EINTR to user-space

do_execve() and ptrace_attach() return -EINTR if
mutex_lock_interruptible(->cred_guard_mutex) fails.

This is not right, change the code to return ERESTARTNOINTR.

Perhaps we should also change proc_pid_attr_write().
Signed-off-by: NOleg Nesterov <oleg@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Acked-by: NRoland McGrath <roland@redhat.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 82e3310a
...@@ -1486,8 +1486,8 @@ int compat_do_execve(char * filename, ...@@ -1486,8 +1486,8 @@ int compat_do_execve(char * filename,
if (!bprm) if (!bprm)
goto out_files; goto out_files;
retval = mutex_lock_interruptible(&current->cred_guard_mutex); retval = -ERESTARTNOINTR;
if (retval < 0) if (mutex_lock_interruptible(&current->cred_guard_mutex))
goto out_free; goto out_free;
current->in_execve = 1; current->in_execve = 1;
......
...@@ -1277,8 +1277,8 @@ int do_execve(char * filename, ...@@ -1277,8 +1277,8 @@ int do_execve(char * filename,
if (!bprm) if (!bprm)
goto out_files; goto out_files;
retval = mutex_lock_interruptible(&current->cred_guard_mutex); retval = -ERESTARTNOINTR;
if (retval < 0) if (mutex_lock_interruptible(&current->cred_guard_mutex))
goto out_free; goto out_free;
current->in_execve = 1; current->in_execve = 1;
......
...@@ -181,8 +181,8 @@ int ptrace_attach(struct task_struct *task) ...@@ -181,8 +181,8 @@ int ptrace_attach(struct task_struct *task)
* interference; SUID, SGID and LSM creds get determined differently * interference; SUID, SGID and LSM creds get determined differently
* under ptrace. * under ptrace.
*/ */
retval = mutex_lock_interruptible(&task->cred_guard_mutex); retval = -ERESTARTNOINTR;
if (retval < 0) if (mutex_lock_interruptible(&task->cred_guard_mutex))
goto out; goto out;
task_lock(task); task_lock(task);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册