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: <20130302184243.GC4503@ZenIV.linux.org.uk>
Date:	Sat, 2 Mar 2013 18:42:43 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Russ Dill <russ.dill@...il.com>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: fasync race in fs/fcntl.c

On Sat, Mar 02, 2013 at 03:00:28AM -0800, Russ Dill wrote:
> I'm seeing a race in fs/fcntl.c. I'm not sure exactly how the race is
> occurring, but the following is my best guess. A kernel log is
> attached.
> 
> The comment for fasync_insert_entry:
> 
>  * NOTE! It is very important that the FASYNC flag always
>  * match the state "is the filp on a fasync list".
> 
> Is not always true leading to deadlock.
> 
> CPU0 calls syscall fcntl(fd, F_SETFL, FASYNC)
> fcntl calls fdget_raw, the count on the filp is 1, so it is not
> incremented (no reference taken)

You misunderstand what fdget_raw() checks, but in any case...

> pointer points to freed memory. send_sigio is called with this
> pointer, which calls read_lock(&fown->lock), however, the memory used
> by that lock has been reused and the system hardlocks.

... what makes you think that it's fown->lock, in the first place?

> [172635.399651]  <<EOE>>  [<ffffffff816c3e13>] _raw_read_lock+0x13/0x20
> [172635.399654]  [<ffffffff811a4532>] send_sigio+0x52/0xf0

send_sigio() is
	[initialization of a local variable to 1]
	read_lock(&fown->lock);
	[getting type and pid, checking them]
	read_lock(&tasklist_lock);
	[loop doing the majority of work]
	read_unlock(&tasklist_lock);
	read_unlock(&fown->lock);
and you are at about 1/3 into the function.  Who said it's fown->lock and
not tasklist_lock?  Could you check (or post) disassembly of send_sigio
to see which one it is?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ