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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <766785311ebb5f5b0f36196f67125262a7c7afe8.camel@redhat.com>
Date:   Thu, 13 Sep 2018 13:05:51 -0400
From:   Doug Ledford <dledford@...hat.com>
To:     Cong Wang <xiyou.wangcong@...il.com>, linux-kernel@...r.kernel.org
Cc:     linux-rdma@...r.kernel.org, Jason Gunthorpe <jgg@...lanox.com>,
        Leon Romanovsky <leon@...nel.org>
Subject: Re: [PATCH] ucma: fix a use-after-free in ucma_resolve_ip()

On Wed, 2018-09-12 at 16:27 -0700, Cong Wang wrote:
> There is a race condition between ucma_close() and ucma_resolve_ip():
> 
> CPU0                            CPU1
> ucma_resolve_ip():              ucma_close():
> 
> ctx = ucma_get_ctx(file, cmd.id);
> 
>         list_for_each_entry_safe(ctx, tmp, &file->ctx_list, list) {
>                 mutex_lock(&mut);
>                 idr_remove(&ctx_idr, ctx->id);
>                 mutex_unlock(&mut);
>                 ...
>                 mutex_lock(&mut);
>                 if (!ctx->closing) {
>                         mutex_unlock(&mut);
>                         rdma_destroy_id(ctx->cm_id);
>                 ...
>                 ucma_free_ctx(ctx);
> 
> ret = rdma_resolve_addr();
> ucma_put_ctx(ctx);
> 
> Before idr_remove(), ucma_get_ctx() could still find the ctx
> and after rdma_destroy_id(), rdma_resolve_addr() may still
> access id_priv pointer. Also, ucma_put_ctx() may use ctx after
> ucma_free_ctx() too.
> 
> ucma_close() should call ucma_put_ctx() too which tests the
> refcnt and waits for the last one releasing it. The similar
> pattern is already used by ucma_destroy_id().
> 
> Reported-and-tested-by: syzbot+da2591e115d57a9cbb8b@...kaller.appspotmail.com
> Reported-by: syzbot+cfe3c1e8ef634ba8964b@...kaller.appspotmail.com
> Cc: Jason Gunthorpe <jgg@...lanox.com>
> Cc: Doug Ledford <dledford@...hat.com>
> Cc: Leon Romanovsky <leon@...nel.org>
> Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>

Thanks, applied to for-rc.

-- 
Doug Ledford <dledford@...hat.com>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ