From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5492731AABF for ; Tue, 23 Jun 2026 16:48:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782233307; cv=none; b=ck+2rUp2Gnw6+3VfYwV88kGhjiWeUFJbRjK9pqkb+p+BdR6O7TyiPXwkhOdURqxKqUcJn+c1gA464MluV+pZ00U2NXUqjFdEAKLQ2DdaNO37HUJzkfGoWNFS8vnC81ndddFqWRly/WG3YW9GgsvxMYmu26yGrh9vBK2c2Q/7stI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782233307; c=relaxed/simple; bh=5W9/ysumqOx/C+0z46WnNJc2ZT8vCEWjgUPP9cz3mcw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Zq+FqkQVIyg7sf5LQzs8M4mr9x2ycakbNI+Vzg91FWNFJbYWtO9HDnKlBpTgncQYy8692/+C/xHZ4K9kZESrrUgPepNlE8Z/e2y9DDxOTPXFgYHBPQLNu6xli2pwMtKd6dllsPMBH3Um2QtRQdtNy8ZVfQ6sFrdvQs+9JaIxjBA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BLft5KCT; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BLft5KCT" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-84232e83ca9so76417b3a.2 for ; Tue, 23 Jun 2026 09:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782233305; x=1782838105; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TuCsDRN0XC49lSZ5pSlY0k50HNKNpHDnltXtgvvLnGA=; b=BLft5KCTw0/hChM9fZkA1zNKMSEoaesq6UtK6XR+rZET67uWoV+GYbWngnyM3YcVlX irazIHpvZlGz6XHV7rqYc7dj1EwSQqlwFMcNEVwUBc0r68l07TaWrLsuEy+eVrmUsiDc 4sH6HbgTXgH5gMxced3PzVOWu55l3Fo2oQQyanuyENRuRWGKuC06/HANJjw9ecQeSoX5 PJYJQodKi3psSAJpdmwlc1ieC2hGIMiiMwUrgoNX7X2drUmG3Gp89XMSk1e2ogS8mSil oZBepW8anXLXYYACKBn63K5ZdEs/AjcMgiNfcCymnIf1bEcOLZyhph3tXWva4uy6TNFm nr9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782233305; x=1782838105; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TuCsDRN0XC49lSZ5pSlY0k50HNKNpHDnltXtgvvLnGA=; b=ce8/EwVY4cvbrr/1J9FCpB1MCJtVSYYZE18Ug1A012wupRvrl71Vk7CqonIvdQihrH 79qCa9oRO0EPI6bh/A/FDGS1BvbSikG/XMw/B4oOBpa/nxB7P051A9Ola9b8k0Li01v+ ox5dHMtNJyxU98Vf4kU1jWo3e9S5wq3NTj0b3nzWqC4Z50TTaJJ5S9yDYXEijcXpENoH TnssRIq848xI07KNv5xvToNKRLh01VD9WpNv83pIBft4XqhY60gXLNPuEauRRs/SRWIv qFkTMh2K93yODOZrWTLLCXdqBU5PJDSCy48Ec8YjDONZsFjAiYyoio3D4stKTnwpoj6v NZxw== X-Forwarded-Encrypted: i=1; AFNElJ+q/lHY3MbgTb9OHXXu4tLysBuU04tH/uIBsx4H1y1tgBASCJbQyBqChTSMrqliUnVF3P1bLMOCHg==@vger.kernel.org X-Gm-Message-State: AOJu0YysPWCEnP843xrI4S8Qq8Yj2yGgNWK5NBvFfR6VD5Iyn7S6cnNd T7w+/0tKxwHneKhHROET/ahDh1TqMbyhI+gpKkpSgYBEGcQbUfbbvmCk X-Gm-Gg: AfdE7cnnbMZxIwDdkRsuSElDIiqZrmAC6JYaMl+co8u2n85N0+yFFL2cyDJA9e9VnCU IX38XwVyU/10k/urOI6IEFWkn8+X/XbRaiJ7RoiydYZWjncHTRtq5tdkzDsl4r1B+7B1knaoXFq CT20q/g611ecfqkQhVGJKDz0X23GGZ1VUE1+sUbicU52qbCTcCvLUc60kMFYvI8qXCHOiXFtnHI VGE5EujIeYIAwX/BT3bSZoo7U2ngVPPb2pUZZBfP9Llv2GyrWmtGqTu/zDg/lTTpL32En2yjO8Q cGX7I6hP6XtK30mGeVi+bQPGWgMNcF1c283eCBG5HkwbMmL4/8AJweskWTqnxyzZ7G0VUPVoTjN 0VByC+RDVkLEy2sOk/Giwj1g19COJE+aUHvUcD/j4QY+1ZiKFbpIeTMC0LxJIdqtoJnuN5JXEpX yVhDqcEis/E1hfRbgKsdRNYASpCdnIZD9QZRyGrzk6aqVONw== X-Received: by 2002:a05:6a00:4616:b0:842:7992:bdc5 with SMTP id d2e1a72fcca58-8459544013fmr4670334b3a.41.1782233305513; Tue, 23 Jun 2026 09:48:25 -0700 (PDT) Received: from Athena ([58.146.97.171]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84564ecd779sm11373382b3a.53.2026.06.23.09.48.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2026 09:48:25 -0700 (PDT) From: Harshal Chavan To: krisman@suse.de Cc: axboe@kernel.dk, gregkh@linuxfoundation.org, gustavoars@kernel.org, harshal24.chavan@gmail.com, io-uring@vger.kernel.org, kees@kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] io_uring/register: add IORING_REGISTER_CLONE_FILES opcode Date: Tue, 23 Jun 2026 22:18:01 +0530 Message-ID: <20260623164801.5680-1-harshal24.chavan@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <871pdyxrxw.fsf@mailhost.krisman.be> References: <871pdyxrxw.fsf@mailhost.krisman.be> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Gabriel Krisman Bertazi @ 2026-06-22 20:04 UTC writes: >Hello, > >Do you have the liburing side and test cases? > >A few comments inline. Hello, Yes I will update the liburing side with helper function and add appropriate test cases. >> + /* clone file descriptors from another ring*/ > ^ spacing Fixed in v5 >> + if (ctx->user != src_ctx->user || ctx->mm_account != src_ctx->mm_account) >> + return -EINVAL; > >I don't think it makes sense to check ->user here. But is mm_account >necessary either? How could you get the src_ctx from another process? Yes, Keeping this check would unnecessarily break valid use case like Root user passing FDs to guest user Removed it completely in v5, thanks for catching this!. >> + registered_src = (clone_arg.flags & IORING_REGISTER_SRC_REGISTERED) != 0; > >This is better written as > >registered_src = !!(clone_arg.flags & IORING_REGISTER_SRC_REGISTERED); Understood, updated this in v5 >> +out: >> + if (src_ctx != ctx) >> + mutex_unlock(&src_ctx->uring_lock); > >Make the mutex_unlock unconditionally above the out label. It is never >locked in the error context. Yes, moved the unlock statement before out without any conditions. Thank you for the review. Regards, Harshal Chavan