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>] [day] [month] [year] [list]
Message-ID: <1822ee2c605.4a717678627753.351372059135065111@siddh.me>
Date:   Sun, 24 Jul 2022 11:56:30 +0530
From:   Siddh Raman Pant <code@...dh.me>
To:     "Hillf Danton" <hdanton@...a.com>
Cc:     "David Howells" <dhowells@...hat.com>,
        "Fabio M. De Francesco" <fmdefrancesco@...il.com>,
        "linux-kernel" <linux-kernel@...r.kernel.org>,
        "syzbot+c70d87ac1d001f29a058" 
        <syzbot+c70d87ac1d001f29a058@...kaller.appspotmail.com>,
        "linux-security-modules" <linux-security-module@...r.kernel.org>,
        "linux-kernel-mentees" 
        <linux-kernel-mentees@...ts.linuxfoundation.org>
Subject: Re: [PATCH v2] kernel/watch_queue: Make pipe NULL while clearing
 watch_queue

On Sun, 24 Jul 2022 10:54:26 +0530  Hillf Danton <hdanton@...a.com> wrote:
> According to sysbot's report [1], what is proposed fails to fix the
> reported uaf in the scenario below because of no wqueue->lock acquired
> in the post path. Despite of defunct checked, it is checked after taking
> pipe's wait lock - a bit too late.
> 
> Hillf
> 
> 	post_one_notification	watch_queue_clear	
> 	===			===
> 	pipe = wqueue->pipe;
> 	if (!pipe)
> 		return false;
> 				spin_lock_bh(&wqueue->lock);
> 				wqueue->pipe = NULL;
> 				spin_lock_bh(&wqueue->lock);
> 
> 				pipe is freed
> 
> 	spin_lock_irq(&pipe->rd_wait.lock); // uaf reported
> 
> 	if (wqueue->defunct)
> 		goto out;
> 
> [1] https://lore.kernel.org/lkml/000000000000aa07b205daba6d49@google.com/
> 

Before post_one_notification(), in __post_watch_notification(), on line 228
wqueue->lock is acquired (using lock_wqueue()).

The comment on post_one_notification() also tells that it should be called
with wqueue->lock held. So we do acquire the lock in the post path.

The pipe is freed after the execution of watch_queue_clear() in
free_pipe_info().

A side note: Your emails don't seem to pop up on lore's LKML archive. Maybe
check if the email isn't being blocked?

Thanks,
Siddh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ