public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin@oracle.com>
To: Al Viro <viro@ZenIV.linux.org.uk>, Dave Jones <davej@redhat.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Cc: Dave Jones <davej@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: vfs: lockdep splat with prepare_bprm_creds
Date: Fri, 15 Mar 2013 00:07:14 -0400	[thread overview]
Message-ID: <51429E72.7090405@oracle.com> (raw)

Hi all,

While fuzzing with trinity inside a KVM tools guest running latest -next kernel
I've stumbled on the following.

Dave Jones reported something similar, but that seemed to involve cgroup's mutex
and didn't seem like it was the same issue as this one.


[  549.400084] ======================================================
[  549.400084] [ INFO: possible circular locking dependency detected ]
[  549.400084] 3.9.0-rc2-next-20130314-sasha-00046-g3897511 #295 Tainted: G        W
[  549.400084] -------------------------------------------------------
[  549.420729] can: request_module (can-proto-0) failed.
[  549.400084] trinity-child20/12048 is trying to acquire lock:
[  549.400084]  (&p->lock){+.+.+.}, at: [<ffffffff8129f11a>] seq_read+0x3a/0x3d0
[  549.400084]
[  549.400084] but task is already holding lock:
[  549.400084]  (&sig->cred_guard_mutex){+.+.+.}, at: [<ffffffff812813d1>] prepare_bprm_creds+0x31/0x80
[  549.400084]
[  549.400084] which lock already depends on the new lock.
[  549.400084]
[  549.400084]
[  549.400084] the existing dependency chain (in reverse order) is:
[  549.400084]
-> #1 (&sig->cred_guard_mutex){+.+.+.}:
[  549.400084]        [<ffffffff8117994a>] check_prevs_add+0xba/0x1a0
[  549.400084]        [<ffffffff8117a100>] validate_chain.isra.21+0x6d0/0x800
[  549.400084]        [<ffffffff8117d523>] __lock_acquire+0xa23/0xb10
[  549.400084]        [<ffffffff8117df3a>] lock_acquire+0x1ca/0x270
[  549.400084]        [<ffffffff83d8786a>] __mutex_lock_common+0x5a/0x5a0
[  549.400084]        [<ffffffff83d87e3f>] mutex_lock_killable_nested+0x3f/0x50
[  549.400084]        [<ffffffff812e8858>] lock_trace+0x28/0x70
[  549.400084]        [<ffffffff812e8a45>] proc_pid_stack+0x65/0xf0
[  549.400084]        [<ffffffff812e9dfa>] proc_single_show+0x5a/0xa0
[  549.400084]        [<ffffffff8129f28f>] seq_read+0x1af/0x3d0
[  549.400084]        [<ffffffff8127a22b>] do_loop_readv_writev+0x4b/0x90
[  549.400084]        [<ffffffff8127a4a6>] do_readv_writev+0xf6/0x1d0
[  549.400084]        [<ffffffff8127a61e>] vfs_readv+0x3e/0x60
[  549.400084]        [<ffffffff8127a690>] SyS_readv+0x50/0xd0
[  549.400084]        [<ffffffff83d946d8>] tracesys+0xe1/0xe6
[  549.400084]
-> #0 (&p->lock){+.+.+.}:
[  549.400084]        [<ffffffff811792c5>] check_prev_add+0x145/0x710
[  549.400084]        [<ffffffff8117994a>] check_prevs_add+0xba/0x1a0
[  549.400084]        [<ffffffff8117a100>] validate_chain.isra.21+0x6d0/0x800
[  549.400084]        [<ffffffff8117d523>] __lock_acquire+0xa23/0xb10
[  549.400084]        [<ffffffff8117df3a>] lock_acquire+0x1ca/0x270
[  549.400084]        [<ffffffff83d8786a>] __mutex_lock_common+0x5a/0x5a0
[  549.400084]        [<ffffffff83d87edf>] mutex_lock_nested+0x3f/0x50
[  549.400084]        [<ffffffff8129f11a>] seq_read+0x3a/0x3d0
[  549.400084]        [<ffffffff812e7b61>] proc_reg_read+0x201/0x230
[  549.400084]        [<ffffffff81279e05>] vfs_read+0xb5/0x180
[  549.400084]        [<ffffffff8127fc61>] kernel_read+0x41/0x60
[  549.400084]        [<ffffffff8127fe0d>] prepare_binprm+0x18d/0x1b0
[  549.400084]        [<ffffffff81281646>] do_execve_common.isra.21+0x1b6/0x380
[  549.400084]        [<ffffffff81281823>] do_execve+0x13/0x20
[  549.400084]        [<ffffffff81281b0e>] SyS_execve+0x3e/0x60
[  549.400084]        [<ffffffff83d94ae9>] stub_execve+0x69/0xa0
[  549.400084]
[  549.400084] other info that might help us debug this:
[  549.400084]
[  549.400084]  Possible unsafe locking scenario:
[  549.400084]
[  549.400084]        CPU0                    CPU1
[  549.400084]        ----                    ----
[  549.400084]   lock(&sig->cred_guard_mutex);
[  549.400084]                                lock(&p->lock);
[  549.400084]                                lock(&sig->cred_guard_mutex);
[  549.400084]   lock(&p->lock);
[  549.400084]
[  549.400084]  *** DEADLOCK ***
[  549.400084]
[  549.400084] 1 lock held by trinity-child20/12048:
[  549.400084]  #0:  (&sig->cred_guard_mutex){+.+.+.}, at: [<ffffffff812813d1>] prepare_bprm_creds+0x31/0x80
[  549.400084]
[  549.400084] stack backtrace:
[  549.400084] Pid: 12048, comm: trinity-child20 Tainted: G        W    3.9.0-rc2-next-20130314-sasha-00046-g3897511 #295
[  549.400084] Call Trace:
[  549.400084]  [<ffffffff83cfd02e>] print_circular_bug+0xd3/0xe4
[  549.400084]  [<ffffffff811792c5>] check_prev_add+0x145/0x710
[  549.400084]  [<ffffffff8117994a>] check_prevs_add+0xba/0x1a0
[  549.400084]  [<ffffffff8106ffa5>] ? sched_clock+0x15/0x20
[  549.400084]  [<ffffffff8117a100>] validate_chain.isra.21+0x6d0/0x800
[  549.400084]  [<ffffffff8117d523>] __lock_acquire+0xa23/0xb10
[  549.400084]  [<ffffffff8109b1c8>] ? kvm_clock_read+0x38/0x70
[  549.400084]  [<ffffffff811776ae>] ? lock_release_holdtime+0x12e/0x140
[  549.400084]  [<ffffffff8106ffa5>] ? sched_clock+0x15/0x20
[  549.400084]  [<ffffffff8114d2c5>] ? sched_clock_local+0x25/0x90
[  549.400084]  [<ffffffff81259396>] ? deactivate_slab+0x7d6/0x820
[  549.400084]  [<ffffffff8117df3a>] lock_acquire+0x1ca/0x270
[  549.400084]  [<ffffffff8129f11a>] ? seq_read+0x3a/0x3d0
[  549.400084]  [<ffffffff8114d2c5>] ? sched_clock_local+0x25/0x90
[  549.400084]  [<ffffffff8129f0e0>] ? seq_lseek+0x110/0x110
[  549.400084]  [<ffffffff83d8786a>] __mutex_lock_common+0x5a/0x5a0
[  549.400084]  [<ffffffff8129f11a>] ? seq_read+0x3a/0x3d0
[  549.400084]  [<ffffffff8117be32>] ? __lock_is_held+0x52/0x80
[  549.400084]  [<ffffffff8129f11a>] ? seq_read+0x3a/0x3d0
[  549.400084]  [<ffffffff8129f0e0>] ? seq_lseek+0x110/0x110
[  549.400084]  [<ffffffff83d87edf>] mutex_lock_nested+0x3f/0x50
[  549.400084]  [<ffffffff8129f11a>] seq_read+0x3a/0x3d0
[  549.400084]  [<ffffffff819f19cd>] ? delay_tsc+0xdd/0x110
[  549.400084]  [<ffffffff8129f0e0>] ? seq_lseek+0x110/0x110
[  549.400084]  [<ffffffff8129f0e0>] ? seq_lseek+0x110/0x110
[  549.400084]  [<ffffffff812e7b61>] proc_reg_read+0x201/0x230
[  549.400084]  [<ffffffff812e7960>] ? proc_reg_write+0x230/0x230
[  549.400084]  [<ffffffff81279e05>] vfs_read+0xb5/0x180
[  549.400084]  [<ffffffff8127fc61>] kernel_read+0x41/0x60
[  549.400084]  [<ffffffff8127fe0d>] prepare_binprm+0x18d/0x1b0
[  549.400084]  [<ffffffff81281646>] do_execve_common.isra.21+0x1b6/0x380
[  549.400084]  [<ffffffff81281823>] do_execve+0x13/0x20
[  549.400084]  [<ffffffff81281b0e>] SyS_execve+0x3e/0x60
[  549.400084]  [<ffffffff83d94ae9>] stub_execve+0x69/0xa0


Thanks,
Sasha

             reply	other threads:[~2013-03-15  4:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15  4:07 Sasha Levin [this message]
2013-03-15  4:26 ` vfs: lockdep splat with prepare_bprm_creds Al Viro
2013-03-15 18:19   ` Oleg Nesterov
2013-03-16 19:41     ` Al Viro
2013-03-17 17:07       ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51429E72.7090405@oracle.com \
    --to=sasha.levin@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox