From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 58C9831AF07 for ; Tue, 23 Jun 2026 16:48:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782233307; cv=none; b=Cnk6FAkn3KAXtSA2Y4p9WiyuY7Cfr2KYEQU5uexja6jmoEqTMMStlUYJY7CG23Ig4d7tP/qOBZXOeec6RLAFE71xKB9HeLg2bl2eVJP4rYts/e95NIF/SoACHL7fHgWE0N2pE4IsaHr77Ldf0UdrXZMdN/2/kvs2gtBwlUxKCOk= 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.182 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-f182.google.com with SMTP id d2e1a72fcca58-84237c55ef9so143383b3a.0 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=AMa2dCXgx+iqhebeX7h+Blk7IYeTO95+02PxoaqCZFX8mENnv9vJOr0Z2GZ9jo7EMu xjBUMdByV/oCprDfzwqV9vxJpvW+6nnkYGLCYmKunouk2MZgf3SEldA9JXKA5U1vi/z/ jCVVIfsSLsFvmBCFXPNyHhmSVzEeQkN8/mVDA8t+aPZh33QUV62VqTnpZVMkoLzXPksG 0ECpNJLg/ediLxa0FlvuGJDc/ArKll1uM/YswJbg3lfiSp7EbmHG3naw7/yKv7XxnY2r BkKEpcOTNiRYzs1RIULAM41gq7t68jcNqfz/aXwrhNVBFB6AngyFQqUNrxnFTkYelIJk r9fw== X-Forwarded-Encrypted: i=1; AFNElJ+dOoC+Dhn86OV8a/9YfAJfaZwwyprt0eUH4H/WI+Rl9Wpkuf+no6yapGv4QRU4xMNlyVFRkKDXvpZ7Mjs=@vger.kernel.org X-Gm-Message-State: AOJu0YxDTNODXUKFzQwtGg/Msa8KtyYwYaYKtlkqoUVS55WYZsnaOHCw Ecy8z82BQPwg4sbKnKBzDP5CVrk+5xqeEuuhaAeY/MN+db0vXPNdqPO65AS2yscL X-Gm-Gg: AfdE7cksSIOYWgMTFri8gDegLzXKkipflNIXtJMyrC3KqWgZopvY53cEr4bS0E8G93q HJBBdZhz1PM4khVdPNUAEF14hWjAy1o2/cv2pWL6DTOqRdpR1nABC6BoH9f4bA6tMYqJSxayvK0 HJ1qcSIAMGNAQ+Vx3gqDt5WC7cV5pv30aGZGJBUHPCy7+DQVHhovFgJttv0K0fn0PZMTzNQHEqy WoRZOadH6YdK/4bUdnZOFUizXv4vtVg6so/tNKMkm1ll/y8BwkiO6Q206C0UbiXGmw4JykugoTM S7PlH7gMDHu8uOwJ6b1O2nOJSPxSTb7r/FDcJvpYT6YQJj9+cInSTuDgRh5cDfcgXZq8XakxB9f +n1YLgqI7f7MihDSf5bNUJAEo2zOoY+QIBV9GGsEpdr5TJAVcWkJkaP07EvpfYy1m4VMzmeiHvD yhkZOn/qyGxuIFDxk5EyWy/UNaGSjpBIUI7GjxUFl7s/XhcA== 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: linux-kernel@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