From patchwork Thu Dec 21 03:09:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ahelenia_Ziemia=C5=84ska?= X-Patchwork-Id: 181958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp156422dyi; Wed, 20 Dec 2023 19:11:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFInIpI26Dxiayq79+8htdvbqqddB15/ZTNXr48f9qM4YSvMQo9HFMc+30/XbEjgY7q5968 X-Received: by 2002:a50:a456:0:b0:553:2e17:91ed with SMTP id v22-20020a50a456000000b005532e1791edmr4034514edb.79.1703128262059; Wed, 20 Dec 2023 19:11:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703128262; cv=none; d=google.com; s=arc-20160816; b=wWeliiPUkFqJJ2AMpJYu7XYbDaSnwyT6MK0O0oQUeR6ujzj19pEht1+uYu1YIchJ37 RhiUTbx1nprlloLC3XYd2X1j5Of4xKOMr03Nj9QxigEhEr1rd7KeEYaqSu4KReSxXcoI QNFNcq5TuSJ0sBj1A2AGc5Uw8VQFWLWjGAUmpLJNwwYlW2go+ad5Jh2xnazgOrGRfC+O 3xkclTGMN+a129IpiVetGwsGi7BbhYRNn0ABNkHQ5+h7HFCk0QztnuXETCvE9+ATPbj8 ER+I6+2SxO8/wOW1CrpGmfYBZaypvinzpUoRtVAdo51AS/+Nv5fOrVfgHxNLNaJC1BwM PDgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:from:date:dkim-signature; bh=+JG6p/dUUxPKmILhZ1CS2oupiBhYLxiyWEoMn2UlhHw=; fh=y7LXc5iJuLiQ2Xew/qfAuhssf5aRVgXccmcqmDrOcxM=; b=qjE6uIS/Ruf+SxexaPcul2frfiotSCcKLoe6841MobAc8fSeBV8ns8bPe/K87TlZfR SMXja4hZWmxWkbsRKE/r4bTuH4wRsylpe1P9lEnX5yvN0uGX5MpWfG5PXSB2IlEpH6Ob VSzsCeXNJKf7Muz4rANdVUwDX0uuTlDgUV6uH5YRx8AHY7/Yq+7rN2XVc+jI9nHu/MzN 2xqh+AqxOOE7lKR0Agoydn9IZ2bD5luMFv2pMBrE0EM1iyoCTRa1P2KUAfFURgzL910o FBZAeqfJI8CZ5g6eFZJwWq1lkfItEnW1ieNPUPU2BAdlJtjJNZINEecbHToe0cA1DqlG 8vLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=nkTFe+Uc; spf=pass (google.com: domain of linux-kernel+bounces-7778-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7778-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nabijaczleweli.xyz Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id er15-20020a056402448f00b00553e65efa0esi424754edb.551.2023.12.20.19.11.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 19:11:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7778-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@nabijaczleweli.xyz header.s=202305 header.b=nkTFe+Uc; spf=pass (google.com: domain of linux-kernel+bounces-7778-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7778-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nabijaczleweli.xyz Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1F2281F21E8C for ; Thu, 21 Dec 2023 03:11:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 932D615AE9; Thu, 21 Dec 2023 03:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nabijaczleweli.xyz header.i=@nabijaczleweli.xyz header.b="nkTFe+Uc" X-Original-To: linux-kernel@vger.kernel.org Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B53C11733; Thu, 21 Dec 2023 03:09:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nabijaczleweli.xyz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nabijaczleweli.xyz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1703128143; bh=6cAMXGnL8xft83SbIhEKbKmwbcXCq5q+4GH8QxHM/tU=; h=Date:From:Cc:Subject:References:In-Reply-To:From; b=nkTFe+UcamJPNdAUF84BUUelHqg5p0U2NAf/DySmBvEG1zMkvmE8aQS/RngAaN4Kz zC5+ksKX3o+01b3rHDWmjsUPIBqXUwr3xzsNHXotTXW4jdRFqHlhE9rm/Zsq9V1AiA 5lURoPVM0hVQz/fQN2B+ZOeK1vzk+UD962C8pCjJr2FU0KLs+EcbZDBIgDIcbwG0tU vs2YV9lOSzqMm3wKj3T5mo9w7pWrHmRIYG4lNbVOm7PNGIpf7IqR/UXlNdTtDoVOFH OSTHH3079/bf8upcZ4UjTbYiO9zGahq4NJr275pKX86OKXmpB8JBMEBkkpUFLqy5xq UNIiRVnlOhrXA== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 5C10313776; Thu, 21 Dec 2023 04:09:03 +0100 (CET) Date: Thu, 21 Dec 2023 04:09:03 +0100 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= Cc: Jens Axboe , Christian Brauner , Alexander Viro , linux-fsdevel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Howells , Shigeru Yoshida , Kuniyuki Iwashima , Peilin Ye , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 05/11] kcm: kcm_splice_read: always request MSG_DONTWAIT Message-ID: <0d8847df2f13e0831ee2f5504d06d5d12036d8f9.1703126594.git.nabijaczleweli@nabijaczleweli.xyz> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20231103-116-3b855e-dirty X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785859420536937218 X-GMAIL-MSGID: 1785859420536937218 Otherwise we risk sleeping with the pipe locked for indeterminate lengths of time ‒ given: cat > kcm.c <<^D #define _GNU_SOURCE #include #include #include #include int main() { int kcm = socket(AF_KCM, SOCK_SEQPACKET, KCMPROTO_CONNECTED); for (;;) splice(kcm, 0, 1, 0, 128 * 1024 * 1024, 0); } ^D cc kcm.c -o kcm mkfifo fifo ./kcm > fifo & read -r _ < fifo & sleep 0.1 echo zupa > fifo kcm used to sleep in splice and the shell used to enter an uninterruptible sleep in open("fifo"); now the splice returns -EAGAIN and the whole program completes. Also: don't pass the SPLICE_F_*-style flags argument to skb_recv_datagram(), which expects MSG_*-style flags. This fixes SPLICE_F_NONBLOCK not having worked. Signed-off-by: Ahelenia Ziemiańska --- net/kcm/kcmsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index 65d1f6755f98..ccfc46f31891 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -1028,7 +1028,7 @@ static ssize_t kcm_splice_read(struct socket *sock, loff_t *ppos, /* Only support splice for SOCKSEQPACKET */ - skb = skb_recv_datagram(sk, flags, &err); + skb = skb_recv_datagram(sk, MSG_DONTWAIT, &err); if (!skb) goto err_out;