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: <20220114161138.GW947480@paulmck-ThinkPad-P17-Gen-1>
Date:   Fri, 14 Jan 2022 08:11:38 -0800
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     Ming Lei <ming.lei@...hat.com>
Cc:     Boqun Feng <boqun.feng@...il.com>, Hillf Danton <hdanton@...a.com>,
        syzbot <syzbot+4f789823c1abc5accf13@...kaller.appspotmail.com>,
        Joel Fernandes <joel@...lfernandes.org>,
        Lai Jiangshan <laijs@...ux.alibaba.com>,
        linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com,
        quic_neeraju@...cinc.com, frederic@...nel.org, urezki@...il.com,
        Jens Axboe <axboe@...nel.dk>
Subject: Re: [syzbot] KASAN: use-after-free Read in srcu_invoke_callbacks

On Fri, Jan 14, 2022 at 11:58:24PM +0800, Ming Lei wrote:
> On Fri, Jan 14, 2022 at 07:27:52AM -0800, Paul E. McKenney wrote:
> > On Fri, Jan 14, 2022 at 10:38:42PM +0800, Boqun Feng wrote:
> > > Hi,
> > > 
> > > On Tue, Jan 11, 2022 at 11:05:00AM -0800, Paul E. McKenney wrote:
> > > [...]
> > > > > > The buggy address belongs to the object at ffff8880189b5c70
> > > > > >  which belongs to the cache request_queue_srcu of size 3816
> > > 
> > > This cache name drew my attention when I was trying to look into this,
> > > because I couldn't find it in v5.16, later on I realized the UAF was
> > > found in linux-next and the commit introducing the cache was merged into
> > > mainline if 5.17 merge window:
> > > 
> > > 	704b914f15fb blk-mq: move srcu from blk_mq_hw_ctx to request_queue
> > > 
> > > I think the UAF is actually a bug introduced by the commit, because in
> > > that commit srcu structure was moved from blk_mq_hw_ctx to
> > > request_queue, and therefore the cleanup_srcu_struct() should be moved
> > > from blk_mq_hw_sysfs_release() to blk_release_queue(), however the above
> > > commit only deleted the one in blk_mq_hw_sysfs_release() but didn't add
> > > a new one in blk_release_queue(). As a result when a request queue is
> > > freed, the srcu structure is not fully clean up, therefore the UAF.
> > > 
> > > IOW, something like below (untested) should fix this. Copy the auther
> > > and block maintainers.
> > 
> > One question for the author and block maintainers...  Why not simply have
> > a single srcu_struct for all of the queues?  Or is there some situation
> > where you need one queue's reader to avoid blocking other queues' SRCU
> > grace periods?
> 
> Because srcu_struct is too fat, and only few drivers need it, and
> most block drivers needn't it.

Fair points.

But would it make sense to dynamically allocate a single srcu_struct
when the first need arose, and only remove it when the last need passed?

							Thanx, Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ