Re: vfs: lockdep splat with prepare_bprm_creds

From: Oleg Nesterov
Date: Sun Mar 17 2013 - 13:09:57 EST

On 03/16, Al Viro wrote:
> On Fri, Mar 15, 2013 at 07:19:56PM +0100, Oleg Nesterov wrote:
> > Cough... I am shy to disclose my ignorance, but could you explain how
> > open_exec()->do_filp_open(MAY_EXEC) can succeed in this case? At least
> > acl_permission_check() looks as if open_exec() should fail...
> Umm... point. It might be a false positive, actually - some other
> seq_file-based sucker (while chmod +x /proc/self/stack will fail,
> chmod +x /proc/vmstat won't) that could be fed to execve(), leading to
> 1) kernel_read() from execve() can grab m.lock for *some* seq_file m,
> while holding ->cred_guard_mutex

Yes, thanks.

I am wondering if lock_trace() is really useful...

Lets ignore proc_pid_syscall() and proc_pid_personality(). Suppose we
change proc_pid_stack()

int proc_pid_stack(...)

save_stack_trace_tsk(task, &trace);
if (!ptrace_may_access(task, PTRACE_MODE_ATTACH))
goto return -EPERM;

for (i = 0; i < trace.nr_entries; i++)

return 0;

Sure, without cred_guard_mutex we can race with install_exec_creds(). But
is it a problem in practice? In any case lock_trace() can't protect against

We can even do

err = __ptrace_may_access(task, mode);
if (!err)

This way task_lock() protects us against exec_mmap(). And even exec_mmap()
was already called and the task is going to do install_exec_creds() we can't
show the stack of this process "after" exec.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at