Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp223113rwd; Fri, 26 May 2023 18:22:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7eqSac1p1HGXLTKIkTc7YIU2xX9RU+zg0ref1lQ5dD7QjNV9S0yZ+LlwX2WRuf/7rkPK0z X-Received: by 2002:a17:902:ce0a:b0:1af:fd3a:2b7d with SMTP id k10-20020a170902ce0a00b001affd3a2b7dmr5141620plg.48.1685150538572; Fri, 26 May 2023 18:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685150538; cv=none; d=google.com; s=arc-20160816; b=yICPoSlPFtUor7yk+DBrPAnYXQ+X+r6Niyjj3nDzBeluPokVfl8gQEd+yTWk6DGqTf DeoSIuuLvHuBFwHpea2rVlGejIW5GWE2eAv97IkjDrjDGWtQ0o89rDlp3R7ftYm9gSAx sUrqU4VmWXIrXHazMuJg+Y6eoucxPoeCqi6kPApH823NaTJv74fqmGysPm6ngwpUXFHz Ku6dsrcfu0P9WoILN0HNYcQB6k8w8wMDZivSUUJeLmB3dkIN18g8btnwEKRzN9saQjCJ Bmv6cVW1RfXz8GEOlrdoEB9F44Chz9ZUahnvALXw20U6cE1Kd01lqAUKlefORDox2JXC 9FXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=AlfmYzIoiKo/BoKxuxICyp2smxZCiLJelwwfMJDh0C8=; b=uGSclWvZ0V/ft5GGPAiYeBJBBHSjubEm0vhNgSWncpSlrG7PjO16BKsAuCMY4dinvn EvcC6rRzCfvoruizsfuoGU2Xv6Bhq24+jRXcFij4Xr9PQGRlMY1GO67UXArlB4wSWNmk fReZ5905tTmHUleF5fFbvTBXXl4iPeqdwBMrN/a42tqYpxJ3qx5/AeMelCHqj9fWqYnd c7UTMFS9d0hVNWFZCBc+3uEV/jgZg8L/dG6NLn1ZNhoX34ruvETtJYDT4WPJMNj6fYf8 GG1s0/Z4EHr+baNqoZlJWZdyo5HPb/y3YgdeBZ2x9UwBSJSundUe+ik6BjLZl2ysX+G3 Y+Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T0S4ZXib; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020a170903110e00b001a814f7db5fsi5446329plh.632.2023.05.26.18.22.05; Fri, 26 May 2023 18:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T0S4ZXib; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230083AbjE0BNm (ORCPT + 99 others); Fri, 26 May 2023 21:13:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229762AbjE0BNl (ORCPT ); Fri, 26 May 2023 21:13:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE05218D for ; Fri, 26 May 2023 18:13:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 49B1D63FD0 for ; Sat, 27 May 2023 01:13:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12EE4C433EF; Sat, 27 May 2023 01:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685150019; bh=bnZn/fQHYsSl0pv4U7PItA9rlBxxlQgsJQwYXNj4rNk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=T0S4ZXibwLE948S8DRkzaDSL0v6FqP/y6telzB9wrL9huYI6cKGaMzFhOr+Pgqhyr L52M64xyEB3qyUrRqc9lOSlGxwf8O/Evs//Dr8tmDSQ5zDmrZSjnSFtpG+SvcbGg21 AlC2Dd7CT/iaW9EuBn6kFNvboA3TIQ+KXblFHF/ZJWEAvn8cEmp2EQmcyMYtlxhJGH znZxp/KUtnS5hM/pWGE7sp+VZD+tvEC2616y+RGcnb2UuXbhkalLlcRbIuArJ6AKs/ vLIopOHNRkuWFx1VTcwciH0SAVhfg8LT6eOvHa0PhwGMsvVJXNSOHDEr7blO/kBIep 049T+tKPBZfvQ== Date: Fri, 26 May 2023 18:13:38 -0700 From: Jakub Kicinski To: David Howells Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chuck Lever , Boris Pismenny , John Fastabend Subject: Re: [PATCH net-next 10/12] tls/sw: Convert tls_sw_sendpage() to use MSG_SPLICE_PAGES Message-ID: <20230526181338.03a99016@kernel.org> In-Reply-To: <20230524153311.3625329-11-dhowells@redhat.com> References: <20230524153311.3625329-1-dhowells@redhat.com> <20230524153311.3625329-11-dhowells@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 24 May 2023 16:33:09 +0100 David Howells wrote: > Convert tls_sw_sendpage() and tls_sw_sendpage_locked() to use sendmsg() > with MSG_SPLICE_PAGES rather than directly splicing in the pages itself. > > [!] Note that tls_sw_sendpage_locked() appears to have the wrong locking > upstream. I think the caller will only hold the socket lock, but it > should hold tls_ctx->tx_lock too. Lock ordering, as you probably discovered. It is what it is :| > + if (msg->msg_flags & ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL | > + MSG_CMSG_COMPAT | MSG_SPLICE_PAGES | > + MSG_SENDPAGE_NOTLAST | MSG_SENDPAGE_NOPOLICY)) > + return -EOPNOTSUPP; Now MSG_SENDPAGE_* can leak in thru the sendmsg() call? Letting MSG_SENDPAGE_NOPOLICY in seems pretty suspicious, no?