linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Christoph Hellwig <hch@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	syzbot
	<bot+9abea25706ae35022385a41f61e579ed66e88a3f@syzkaller.appspotmail.com>,
	David Miller <davem@davemloft.net>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	syzkaller-bugs@googlegroups.com,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: KASAN: use-after-free Read in sock_release
Date: Thu, 30 Nov 2017 15:46:42 +0000	[thread overview]
Message-ID: <20171130154641.GH21978@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20171130131833.GA28908@infradead.org>

On Thu, Nov 30, 2017 at 05:18:33AM -0800, Christoph Hellwig wrote:
> On Thu, Nov 30, 2017 at 02:07:19AM +0000, Al Viro wrote:
> > Incidentally, grepping for sys_close() shows another piece of fun in
> > net/netfilter/xt_bpf.c.  Folks, ONCE DESCRIPTOR IS INSTALLED, THAT'S
> > IT; THERE'S NO REMOVING IT ON FAILURE EXITS.  sys_close() should
> > never, ever be used that way.  Sigh...
> 
> Would be great do unexport the thing.  Except that we also have
> binfmt_misc (which looks legit) and autofs4, which on crack decided
> that close() isn't a fun syscall, they'd much rather have an ioctl
> that does exactly the same..

Yes, since binfmt_misc one is guaranteed that its descriptor table is
not shared - all callchains go through do_execveat_common(), where we'd
use unshare_files().  autofs one is... not in good taste, but still
safe; there the descriptor is preexisting and it's essentially a weird
way of spelling close(2).  References from syscall tables are, of course,
OK.  init/*.c uses are done pretty much from userland - they could have
been straight syscalls, if not for the lack of klibc in kernel tree.
Everything else, though...

IMO we need a whack-a-mole list somewhere; "new callers of sys_close()
anywhere outside of init/* and syscall tables" definitely should be
on it...

  reply	other threads:[~2017-11-30 15:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <94eb2c19e756c0119b055f1afbd0@google.com>
2017-11-29 19:37 ` KASAN: use-after-free Read in sock_release Cong Wang
2017-11-29 20:24   ` Linus Torvalds
2017-11-30  2:07     ` Al Viro
2017-11-30  4:16       ` Al Viro
2017-11-30 13:18       ` Christoph Hellwig
2017-11-30 15:46         ` Al Viro [this message]
2018-02-13 19:16           ` Dmitry Vyukov
2017-11-29 20:49   ` Eric Dumazet
2017-11-30  2:24   ` Al Viro

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=20171130154641.GH21978@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=bot+9abea25706ae35022385a41f61e579ed66e88a3f@syzkaller.appspotmail.com \
    --cc=davem@davemloft.net \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=torvalds@linux-foundation.org \
    --cc=xiyou.wangcong@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).