From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gadPD-0000V4-I2 for qemu-devel@nongnu.org; Sat, 22 Dec 2018 04:17:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gadP9-0007q8-1k for qemu-devel@nongnu.org; Sat, 22 Dec 2018 04:17:11 -0500 Received: from mail-wr1-f51.google.com ([209.85.221.51]:46938) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gadP8-0007pj-Qu for qemu-devel@nongnu.org; Sat, 22 Dec 2018 04:17:06 -0500 Received: by mail-wr1-f51.google.com with SMTP id l9so7445344wrt.13 for ; Sat, 22 Dec 2018 01:17:06 -0800 (PST) References: From: Paolo Bonzini Message-ID: Date: Sat, 22 Dec 2018 10:17:04 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Segfaults in chardev due to races List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= Cc: "qemu-devel@nongnu.org" On 21/12/18 23:31, Max Reitz wrote: > I suppose the issue is that QMP events are sent by one thread, and > client disconnects are handled by a different one. So if a QMP event is > sent while a client disconnects concurrently, races may occur; and the > only protection against concurrent access appears to be the > chr_write_lock, which I don't think is enough. I think disconnection (tcp_chr_disconnect) has to take the chr_write_lock too. Paolo