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] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 10 Jun 2018 12:27:04 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     xiyou.wangcong@...il.com
Cc:     netdev@...r.kernel.org, shankarapailoor@...il.com,
        penguin-kernel@...ove.sakura.ne.jp, lorenzo@...gle.com,
        viro@...iv.linux.org.uk
Subject: Re: [Patch net] socket: close race condition between sock_close()
 and sockfs_setattr()

From: Cong Wang <xiyou.wangcong@...il.com>
Date: Thu,  7 Jun 2018 13:39:49 -0700

> fchownat() doesn't even hold refcnt of fd until it figures out
> fd is really needed (otherwise is ignored) and releases it after
> it resolves the path. This means sock_close() could race with
> sockfs_setattr(), which leads to a NULL pointer dereference
> since typically we set sock->sk to NULL in ->release().
> 
> As pointed out by Al, this is unique to sockfs. So we can fix this
> in socket layer by acquiring inode_lock in sock_close() and
> checking against NULL in sockfs_setattr().
> 
> sock_release() is called in many places, only the sock_close()
> path matters here. And fortunately, this should not affect normal
> sock_close() as it is only called when the last fd refcnt is gone.
> It only affects sock_close() with a parallel sockfs_setattr() in
> progress, which is not common.
> 
> Fixes: 86741ec25462 ("net: core: Add a UID field to struct sock.")
> Reported-by: shankarapailoor <shankarapailoor@...il.com>
> Cc: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
> Cc: Lorenzo Colitti <lorenzo@...gle.com>
> Cc: Al Viro <viro@...iv.linux.org.uk>
> Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>

I'm applying this for now, it is at least a step towards fixing
all of these issues.

If it is really offensive, I can revert, just tell me.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ