lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5a529481-6fd4-bc8d-6b13-31357d9ae633@I-love.SAKURA.ne.jp>
Date:   Tue, 3 Apr 2018 19:45:10 +0900
From:   Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To:     Eric Biggers <ebiggers3@...il.com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>
Cc:     syzbot <syzbot+7a1cff37dbbef9e7ba4c@...kaller.appspotmail.com>,
        akpm@...ux-foundation.org, dhowells@...hat.com, gs051095@...il.com,
        linux-kernel@...r.kernel.org, oleg@...hat.com,
        pasha.tatashin@...cle.com, riel@...hat.com,
        rppt@...ux.vnet.ibm.com, syzkaller-bugs@...glegroups.com,
        wangkefeng.wang@...wei.com, viro@...IV.linux.org.uk
Subject: Re: KASAN: use-after-free Read in alloc_pid

On 2018/04/03 12:10, Eric Biggers wrote:
> On Mon, Apr 02, 2018 at 06:00:57PM -0500, Eric W. Biederman wrote:
>> syzbot <syzbot+7a1cff37dbbef9e7ba4c@...kaller.appspotmail.com> writes:
>>
>>> Hello,
>>>
>>> syzbot hit the following crash on upstream commit
>>> 9dd2326890d89a5179967c947dab2bab34d7ddee (Fri Mar 30 17:29:47 2018 +0000)
>>> Merge tag 'ceph-for-4.16-rc8' of git://github.com/ceph/ceph-client
>>> syzbot dashboard link:
>>> https://syzkaller.appspot.com/bug?extid=7a1cff37dbbef9e7ba4c
>>>
>>> So far this crash happened 4 times on upstream.
>>>
>>> Unfortunately, I don't have any reproducer for this crash yet.
>>
>> Do you have any of the other traces?  This looks like a something is
>> calling put_pid_ns more than it is calling get_pid_ns causing a
>> reference count mismatch.
>>
>> If this is not: 9ee332d99e4d5a97548943b81c54668450ce641b

Yes, that commit is the trigger. Al wrote patches. Let's check them.

  http://lkml.kernel.org/r/20180402143415.GC30522@ZenIV.linux.org.uk
  http://lkml.kernel.org/r/20180403052009.GH30522@ZenIV.linux.org.uk

----------
struct pid *alloc_pid(struct pid_namespace *ns) {
(...snipped...)
    if (unlikely(is_child_reaper(pid))) {
        if (pid_ns_prepare_proc(ns)) // ns is freed upon failure.
            goto out_free;
    }
(...snipped...)
out_free:
    spin_lock_irq(&pidmap_lock);
    while (++i <= ns->level) // <= ns is already freed by destroy_pid_namespace() explained below.
        idr_remove(&ns->idr, (pid->numbers + i)->nr);
(...snipped...)
}
----------

----------
int pid_ns_prepare_proc(struct pid_namespace *ns) {
  mnt = kern_mount_data(&proc_fs_type, ns) { // <= ns is passed as ns.
    mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, data) { // <= ns is passed as data.
      root = mount_fs(type, SB_KERNMOUNT, name, data) { // <= ns is passed as data.
        root = type->mount(type, SB_KERNMOUNT, name, data) = // <= ns is passed as data.
        static struct dentry *proc_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) {
          return mount_ns(fs_type, SB_KERNMOUNT, NULL, ns, ns->user_ns, proc_fill_super) { // <= ns is passed as ns.
            sb = sget_userns(fs_type, ns_test_super, ns_set_super, SB_KERNMOUNT, user_ns, ns) { // <= ns is passed as ns.
              err = set(s, data) = // <= ns is passed as data.
              static int ns_set_super(struct super_block *sb, void *data) {
                sb->s_fs_info = data; // ns is associated here.
              }
              err = register_shrinker(&s->s_shrink); // <= fail by fault injection.
              deactivate_locked_super(s) {
                fs->kill_sb(s) =
                static void proc_kill_sb(struct super_block *sb) {
                  ns = (struct pid_namespace *)sb->s_fs_info;
                  put_pid_ns(ns) { // <= ns is passed as ns
                    kref_put(&ns->kref, free_pid_ns) { // <= ns refcount becomes 0
                      destroy_pid_namespace(ns) {
                        call_rcu(&ns->rcu, delayed_free_pidns) {
                          kmem_cache_free(pid_ns_cachep, ns); // <= ns is released here after RCU grace period
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
----------

>>
>> I could use a few more hints to help narrow down what is going wrong.
>>
>> It would be nice to know what the other 3 crashes looked like and
>> exactly which upstream they were on.
>>
> 
> The other crashes are shown on the syzbot dashboard (link was given in the
> original email).
> 
> Eric
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ