From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) (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 D5F1320551A for ; Tue, 14 Jan 2025 17:57:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736877476; cv=none; b=sXYKmkrCOf4Tq/IGek+aIRGxH0igDC6B2ZbTGTqRTB+IQD5mDbO8HlaPmy8uqTUm1K4vpDVx7ojceJqRiq4WZir4We0IuHJJU3FVMfLHVjho6eUUSs6qAHwuUWNhrPK+HgaCQ3SLgxU3fBRAO4USxBBJO4npm+oG7pal9K99Pxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736877476; c=relaxed/simple; bh=TxMRwYzCnwl6uQRq6op+ElWOVvdYd8d7nOPZlZWcNiQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=U+TolpaofATxIB4pZq6GnA4CHxtqNnw+k+D5P+6tZTSpPbmkcfhX/2uPbeN+zLC4HzJUIxh/ZWoK+SaNZH/lH6YNXMFLh0/xWNppuX6qh1lHJLWDsOCYWMomWmgWjPkdRcWzMhRId3+JivD1hVYllCIICTzR6vPb9ZA10jIlovc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=czibEJnn; arc=none smtp.client-ip=209.85.166.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="czibEJnn" Received: by mail-il1-f180.google.com with SMTP id e9e14a558f8ab-3cdce23f3e7so43273565ab.0 for ; Tue, 14 Jan 2025 09:57:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1736877472; x=1737482272; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Y7YZstDiXjyB1zPsdbBPJIDIgikogr6PNjNg2k0F+Dc=; b=czibEJnnlPjSEmQf3W1mQ0be8cVy88K6ROUwxTx7LgIsvr58aSpOyQf+Hv3NZHbbjA YpsavFDpjDD229EFN6Er6t4vVAzWxhwgmZzYBBGkAXvBFSvxxEL5kqSp2PMHp5btgopn 6ISBj5bHsfdwrYQTqE80N/WRIrwRHLN5LyEhyT7bfC7erHOMVy6IfJNkgiDivCbeBAd2 /bYw9D9PTo3DuY+OtGiVsLcxMVN8OcHsSrB7zRQHhtZJ6vFOFRrwv5REiux7yV1foZ05 ouObLz05BIqBzrSMWrJSpeUrkFLfzxypZqZQ2og9V16QObTrEdFElQ9Ovplm/ffOLYUw 4Zmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736877472; x=1737482272; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y7YZstDiXjyB1zPsdbBPJIDIgikogr6PNjNg2k0F+Dc=; b=KLP+baM1Wbue6J8siWDsEej6c2anszapV5XyYKGFbuA4xDDRClx8zSctUO1Av4I64e azzlERZacZKBvWvRHMh+UeVmDgoNRkf6xvSCVjodzcZPljtgkEQSMyO3oo378IM9w6cE wQsjru2Tl8aGmqckgzb4wb6IIXju5773VihGY68XyzXHYsL/zs36aMSLAnlZxvzTmS55 xdAjmAlnUBRh58q4bLJBaYZ/j1/3LGahcanSLnO0uXHI3bRa404KDZpQaXZAAuVdZuhR bO4vW+qMwepVjQbx6MeOaE8/Vkoa2bBr5tuBzgpHusO8ICde+g58UbgRjjv6DTY+VHwh be0g== X-Gm-Message-State: AOJu0YyhLONFvJ3JautPP0s4YeDPP5PjMYlDBpAkvLEEONoqmQK6cQlx S0dRFRan59icMaQUTRzv6OktMOVUbd5JpBI7KJU3hdqiti/X/DLfLphSZ1PMjUs= X-Gm-Gg: ASbGnctmRXfaOrmwhHJPKtdKMuDYZRxdzQyN0W12BnwuXqETm4HlAZ8QMDSC1qfpivQ K3AFBDU8aTKudSn/4sLScOXT36pijXxBfYA5n/YI2IV2cIBrkbIw6C3gTDU527VzBA4j5f1AHt0 77o5PdDpE3ZHcSwSPw9J6RDoj36h6vVjGCgAVuDG0sNk58NFMBJFFSv2F1TDbZ1YSrFyikoqCLb vVn5m1+rSj8hYmO9qQPoXKRXwvdHnteR/Gp84LcmF+JP3Q0xNC3 X-Google-Smtp-Source: AGHT+IGM2drpw9X/rMTH6z+8c5xpupNIqajcv4pvVlwSoOOaEK5ifp+uXOoIV7PQX3wBEh9KYkSR2g== X-Received: by 2002:a05:6e02:1d94:b0:3ce:7ab4:1afc with SMTP id e9e14a558f8ab-3ce7ab4225dmr38914715ab.7.1736877471927; Tue, 14 Jan 2025 09:57:51 -0800 (PST) Received: from [192.168.1.116] ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4ea1b7459desm3632119173.125.2025.01.14.09.57.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Jan 2025 09:57:51 -0800 (PST) Message-ID: Date: Tue, 14 Jan 2025 10:57:50 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] io_uring/rsrc: require cloned buffers to share accounting contexts To: Jann Horn , Pavel Begunkov , io-uring@vger.kernel.org Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20250114-uring-check-accounting-v1-1-42e4145aa743@google.com> From: Jens Axboe Content-Language: en-US In-Reply-To: <20250114-uring-check-accounting-v1-1-42e4145aa743@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/14/25 10:49 AM, Jann Horn wrote: > When IORING_REGISTER_CLONE_BUFFERS is used to clone buffers from uring > instance A to uring instance B, where A and B use different MMs for > accounting, the accounting can go wrong: > If uring instance A is closed before uring instance B, the pinned memory > counters for uring instance B will be decremented, even though the pinned > memory was originally accounted through uring instance A; so the MM of > uring instance B can end up with negative locked memory. > > Cc: stable@vger.kernel.org > Closes: https://lore.kernel.org/r/CAG48ez1zez4bdhmeGLEFxtbFADY4Czn3CV0u9d_TMcbvRA01bg@mail.gmail.com > Fixes: 7cc2a6eadcd7 ("io_uring: add IORING_REGISTER_COPY_BUFFERS method") > Signed-off-by: Jann Horn > --- > To be clear, I think this is a very minor issue, feel free to take your > time landing it. > > I put a stable marker on this, but I'm ambivalent about whether this > issue even warrants landing a fix in stable - feel free to remove the > Cc stable marker if you think it's unnecessary. I'll just queue it up for 6.14. Let's just get it towards stable, if nothing else it provides consistent behavior across kernels. IMHO that's enough reason to move it to stable. -- Jens Axboe