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]
Message-ID: <20200917164432.GU3421308@ZenIV.linux.org.uk>
Date:   Thu, 17 Sep 2020 17:44:32 +0100
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Qian Cai <cai@...hat.com>
Cc:     torvalds@...ux-foundation.org, vgoyal@...hat.com,
        miklos@...redi.hu, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: slab-out-of-bounds in iov_iter_revert()

On Thu, Sep 17, 2020 at 10:10:27AM -0400, Qian Cai wrote:

> [   81.942909]  generic_file_read_iter+0x23b/0x4b0
> [   81.942918]  fuse_file_read_iter+0x280/0x4e0 [fuse]
> [   81.942931]  ? fuse_direct_IO+0xd30/0xd30 [fuse]
> [   81.942949]  ? _raw_spin_lock_irqsave+0x80/0xe0
> [   81.942957]  ? timerqueue_add+0x15e/0x280
> [   81.942960]  ? _raw_spin_lock_irqsave+0x80/0xe0
> [   81.942966]  new_sync_read+0x3b7/0x620
> [   81.942968]  ? __ia32_sys_llseek+0x2e0/0x2e0

Interesting...  Basic logics in there:
	->direct_IO() might consume more (on iov_iter_get_pages()
and friends) than it actually reads.  We want to revert the
excess.  Suppose by the time we call ->direct_IO() we had
N bytes already consumed and C bytes left.  We expect that
after ->direct_IO() returns K, we have C' bytes left, N + (C - C')
consumed and N + K out of those actually read.  So we revert by
C - K - C'.  You end up trying to revert beyond the beginning.

	Use of iov_iter_truncate() is problematic here, since it
changes the amount of data left without having consumed anything.
Basically, it changes the position of end, and the logics in the
caller expects that to remain unchanged.  iov_iter_reexpand() use
should restore the position of end.

	How much IO does it take to trigger that on your reproducer?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ