From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dK27O-0001Ag-9P for qemu-devel@nongnu.org; Sun, 11 Jun 2017 08:37:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dK27L-0006W3-65 for qemu-devel@nongnu.org; Sun, 11 Jun 2017 08:37:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34694) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dK27K-0006VH-Vo for qemu-devel@nongnu.org; Sun, 11 Jun 2017 08:37:19 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C722E81233 for ; Sun, 11 Jun 2017 12:37:17 +0000 (UTC) From: Max Reitz Date: Sun, 11 Jun 2017 14:37:14 +0200 Message-Id: <20170611123714.31292-1-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH] qemu-nbd: Ignore SIGPIPE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Max Reitz , Paolo Bonzini , Eric Blake qemu proper has done so for 13 years (8a7ddc38a60648257dc0645ab4a05b33d6040063), qemu-img and qemu-io have done so for four years (526eda14a68d5b3596be715505289b541288ef2a). Ignoring this signal is especially important in qemu-nbd because otherwise a client can easily take down the qemu-nbd server by dropping the connection when the server wants to send something, for example: $ qemu-nbd -x foo -f raw -t null-co:// & [1] 12726 $ qemu-io -c quit nbd://localhost/bar can't open device nbd://localhost/bar: No export with name 'bar' available [1] + 12726 broken pipe qemu-nbd -x foo -f raw -t null-co:// In this case, the client sends an NBD_OPT_ABORT and closes the connection (because it is not required to wait for a reply), but the server replies with an NBD_REP_ACK (because it is required to reply). Signed-off-by: Max Reitz --- I tried to find some other reproducer instead of using a qemu client (e.g. nping -c 1 --tcp-connect localhost -p 10809, which gives the same pattern of PSH-ACK,