From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82702C433DF for ; Mon, 24 Aug 2020 23:16:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5280C20656 for ; Mon, 24 Aug 2020 23:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728148AbgHXXQn (ORCPT ); Mon, 24 Aug 2020 19:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726090AbgHXXQn (ORCPT ); Mon, 24 Aug 2020 19:16:43 -0400 Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 347E6C061574 for ; Mon, 24 Aug 2020 16:16:43 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 326BF129242DF; Mon, 24 Aug 2020 15:59:56 -0700 (PDT) Date: Mon, 24 Aug 2020 16:16:41 -0700 (PDT) Message-Id: <20200824.161641.333865613724287036.davem@davemloft.net> To: luke.w.hsiao@gmail.com Cc: netdev@vger.kernel.org, axboe@kernel.dk, kuba@kernel.org, lukehsiao@google.com, soheil@google.com, arjunroy@google.com, edumazet@google.com, jannh@google.com Subject: Re: [PATCH net-next v3 1/2] io_uring: allow tcp ancillary data for __sys_recvmsg_sock() From: David Miller In-Reply-To: <20200822044105.3097613-1-luke.w.hsiao@gmail.com> References: <0bc6cc65-e764-6fe0-9b0a-431015835770@kernel.dk> <20200822044105.3097613-1-luke.w.hsiao@gmail.com> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 24 Aug 2020 15:59:56 -0700 (PDT) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Luke Hsiao Date: Fri, 21 Aug 2020 21:41:04 -0700 > From: Luke Hsiao > > For TCP tx zero-copy, the kernel notifies the process of completions by > queuing completion notifications on the socket error queue. This patch > allows reading these notifications via recvmsg to support TCP tx > zero-copy. > > Ancillary data was originally disallowed due to privilege escalation > via io_uring's offloading of sendmsg() onto a kernel thread with kernel > credentials (https://crbug.com/project-zero/1975). So, we must ensure > that the socket type is one where the ancillary data types that are > delivered on recvmsg are plain data (no file descriptors or values that > are translated based on the identity of the calling process). > > This was tested by using io_uring to call recvmsg on the MSG_ERRQUEUE > with tx zero-copy enabled. Before this patch, we received -EINVALID from > this specific code path. After this patch, we could read tcp tx > zero-copy completion notifications from the MSG_ERRQUEUE. Would be great to see such test programs added to selftests instead of vaguely being described. > Signed-off-by: Soheil Hassas Yeganeh > Signed-off-by: Arjun Roy > Acked-by: Eric Dumazet > Reviewed-by: Jann Horn > Reviewed-by: Jens Axboe > Signed-off-by: Luke Hsiao Applied.