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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02BC6C6FD1F for ; Thu, 16 Mar 2023 12:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230293AbjCPMNT (ORCPT ); Thu, 16 Mar 2023 08:13:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230179AbjCPMNG (ORCPT ); Thu, 16 Mar 2023 08:13:06 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56FEB3BDA2 for ; Thu, 16 Mar 2023 05:12:59 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id cy23so6623145edb.12 for ; Thu, 16 Mar 2023 05:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678968777; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cX/OidKKVms1plQrNedKAjRZwpwb2EI67KhD7QZ5W24=; b=RLNUA5d/gokNS6HHW0KLR8of2ToILjyBOFVgc2c8jElg3dSqNL59xCKoIdfkfeezv4 qXDrLGuZQueE3iFTPQ22PQKCWshd9LZHXDdzX1WTWeJk8MmHRDNSAC8+86mYfdVTC3WB 24ly/gZhVJn7xlfG44Fspb/stfqORgHvzNMR/s4HcNAkL9FKSg1Hyojpt01T4H0mcN3N 8PgS50s5dcAy3VZF3stg3YuGkZUClmLeJAFtdYXSU/wZOaCKzOaOlFl6pOAV6LrFpcHa kDzbyl7ZuN1Zv0t2vXQIeeQDJGQeE0917vscOmZNB1/2R4+hbDaRwr277yq/68l+52OQ A+6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678968777; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cX/OidKKVms1plQrNedKAjRZwpwb2EI67KhD7QZ5W24=; b=QukgapIh/sdUW6jjJF9eFcy/L1QUm/8austJp7cWx4dWvnnAYgYgahEiYc8a7GI75c fUGpfjy3TdHzbKLSMRXF9H2tY2OMsxJ8UDYhCSuPtzhg61HxGiaVexanE6IROhxlAWDV pW0nMFp2vCTgiDfK8YuJ+ewoMeyPqutS+s4EeAeFiSZl3P0/wsLr7kSLFsO2gZdCoHCI HiS3ZM4Cfk8F+nkfPbigbUALm1g72ZBHLdgjY++RBVoH+jLg9eGcb/r5yIQoWHmAuMya LBAp79DUj3dkr4t2N94Ijys/fTDWpul2iLk3D1Szbt+OWacQumxUK2WXi3IWaC4MLDuj 8rXA== X-Gm-Message-State: AO0yUKV3F5cBiXP3/CNw25BmyLv+EXptY4nsAxZ9ZGT/tQpsloPQCwa0 HKAhkVR/FNO9S/YTU0x65/6WdLRCqSM= X-Google-Smtp-Source: AK7set/LAdzUMr2c6K250GpQ7vlOON3hfKKtAt7EGg2J1cfesTamQwHQjUC+HfqTWfkwFdmLv1FKmg== X-Received: by 2002:a17:907:a649:b0:879:ab3:93d1 with SMTP id vu9-20020a170907a64900b008790ab393d1mr12246661ejc.4.1678968777530; Thu, 16 Mar 2023 05:12:57 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::2:e196]) by smtp.gmail.com with ESMTPSA id v30-20020a50d59e000000b004af7191fe35sm3791095edi.22.2023.03.16.05.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 05:12:57 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH 1/1] io_uring/msg_ring: let target know allocated index Date: Thu, 16 Mar 2023 12:11:42 +0000 Message-Id: <4a5ba7d8d439f1942118f93b9be5c05d6a46f2cd.1678937992.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org msg_ring requests transferring files support auto index selection via IORING_FILE_INDEX_ALLOC, however they don't return the selected index to the target ring and there is no other good way for the userspace to know where is the receieved file. Return the index for allocated slots and 0 otherwise, which is consistent with other fixed file installing requests. Cc: stable@vger.kernel.org # v6.0+ Fixes: e6130eba8a848 ("io_uring: add support for passing fixed file descriptors") Signed-off-by: Pavel Begunkov --- io_uring/msg_ring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/io_uring/msg_ring.c b/io_uring/msg_ring.c index 8803c0979e2a..85fd7ce5f05b 100644 --- a/io_uring/msg_ring.c +++ b/io_uring/msg_ring.c @@ -202,7 +202,7 @@ static int io_msg_install_complete(struct io_kiocb *req, unsigned int issue_flag * completes with -EOVERFLOW, then the sender must ensure that a * later IORING_OP_MSG_RING delivers the message. */ - if (!io_post_aux_cqe(target_ctx, msg->user_data, msg->len, 0)) + if (!io_post_aux_cqe(target_ctx, msg->user_data, ret, 0)) ret = -EOVERFLOW; out_unlock: io_double_unlock_ctx(target_ctx); @@ -229,6 +229,8 @@ static int io_msg_send_fd(struct io_kiocb *req, unsigned int issue_flags) struct io_ring_ctx *ctx = req->ctx; struct file *src_file = msg->src_file; + if (msg->len) + return -EINVAL; if (target_ctx == ctx) return -EINVAL; if (target_ctx->flags & IORING_SETUP_R_DISABLED) -- 2.39.1 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E81AC6FD19 for ; Thu, 16 Mar 2023 12:15:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229923AbjCPMP2 (ORCPT ); Thu, 16 Mar 2023 08:15:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbjCPMP1 (ORCPT ); Thu, 16 Mar 2023 08:15:27 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0919F62D9B for ; Thu, 16 Mar 2023 05:15:26 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id cy23so6651457edb.12 for ; Thu, 16 Mar 2023 05:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678968924; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cX/OidKKVms1plQrNedKAjRZwpwb2EI67KhD7QZ5W24=; b=qSaAPf1jykJRp6GFGRuZmhltivik9stRXTQ/U6F3vxlYDb+YT/6cIN/W29DQxVpQ0P jMtu+5cizJOq30+OxB5Fcfd/COMewmw1qAzt59h11rKnCdZkPPHLo+g3xLtpdoEe9FzJ olyU18ogGd0RUjgNEIiXqMBHpJcWYo+gIom7VkIeE3UDSSxEMxhz6O3+9tCqi4jFyn2A ilY9fsgEKwa1v/+ec1kezAwzl0F51YQjILC11sRFy6qItZIFc3Jnx1Watf1fgZ/4OgD1 T/Vbt/8+FrkWDd8ObSo0L5dUFEn0Rrf4L2zJ4URuQFiMV8TolYQvzsJdkh+5dTQvrriN XlyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678968924; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cX/OidKKVms1plQrNedKAjRZwpwb2EI67KhD7QZ5W24=; b=mSpWVT3EVzwMkFWDt+3+AocLuYxKIqeoVwjgjF4jzSY0OJj4OSpeMa+m7gw7yKVo9x knvtEVe9FbvO/ypeP1uanaxRH7fuLTYJbbbg3ZbxOowPGiYRqRCgfqjKgfCBummfDhjE pP2Sd2hsJUWrfQa5ankuz0JdXDG/+8bKRZkQoGghlLHQHnFPWREImElQtEvcT0vyqDeq xWe4Qww8yIQ9djgM55m1RHKboJpPiqqRT0MZpLx4vsUkRB+mQJLPU4J+6yYhbTriojd6 pFtLdanaXc7RA3uTKhF6bqWjvgGZEVpTAiJxFVgmzXR+K65HoQ98yBrVio7LQXeeQ09k MXxQ== X-Gm-Message-State: AO0yUKXWTLz4mugeVV6sLFlxpVynwehK1SjxJC8G/BUitRKZYQypXdOG 1t7VdWw1USey8CQtYAXZnYjVGTcxAbg= X-Google-Smtp-Source: AK7set8K1urcQ1Su2zdODdU7uAwMS3cIlrx3/w4xU3eg8nUkrq3noLY/5C9d4SErdGsDcaillBMRcQ== X-Received: by 2002:a17:906:28d:b0:8d6:626d:7e03 with SMTP id 13-20020a170906028d00b008d6626d7e03mr10787252ejf.40.1678968924341; Thu, 16 Mar 2023 05:15:24 -0700 (PDT) Received: from 127.com ([2620:10d:c092:600::2:7abd]) by smtp.gmail.com with ESMTPSA id n18-20020a170906701200b00927f6c799e6sm3762116ejj.132.2023.03.16.05.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 05:15:24 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH 1/1] io_uring/msg_ring: let target know allocated index Date: Thu, 16 Mar 2023 12:14:15 +0000 Message-ID: <4a5ba7d8d439f1942118f93b9be5c05d6a46f2cd.1678937992.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Message-ID: <20230316121415.I7eIuBrygUGbClod3BAEWib7Ano8IjIF0HETTZsB0Y0@z> msg_ring requests transferring files support auto index selection via IORING_FILE_INDEX_ALLOC, however they don't return the selected index to the target ring and there is no other good way for the userspace to know where is the receieved file. Return the index for allocated slots and 0 otherwise, which is consistent with other fixed file installing requests. Cc: stable@vger.kernel.org # v6.0+ Fixes: e6130eba8a848 ("io_uring: add support for passing fixed file descriptors") Signed-off-by: Pavel Begunkov --- io_uring/msg_ring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/io_uring/msg_ring.c b/io_uring/msg_ring.c index 8803c0979e2a..85fd7ce5f05b 100644 --- a/io_uring/msg_ring.c +++ b/io_uring/msg_ring.c @@ -202,7 +202,7 @@ static int io_msg_install_complete(struct io_kiocb *req, unsigned int issue_flag * completes with -EOVERFLOW, then the sender must ensure that a * later IORING_OP_MSG_RING delivers the message. */ - if (!io_post_aux_cqe(target_ctx, msg->user_data, msg->len, 0)) + if (!io_post_aux_cqe(target_ctx, msg->user_data, ret, 0)) ret = -EOVERFLOW; out_unlock: io_double_unlock_ctx(target_ctx); @@ -229,6 +229,8 @@ static int io_msg_send_fd(struct io_kiocb *req, unsigned int issue_flags) struct io_ring_ctx *ctx = req->ctx; struct file *src_file = msg->src_file; + if (msg->len) + return -EINVAL; if (target_ctx == ctx) return -EINVAL; if (target_ctx->flags & IORING_SETUP_R_DISABLED) -- 2.39.1