From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.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 6BFA036680E for ; Tue, 21 Jul 2026 14:54:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784645663; cv=none; b=g3kt0HLGbwFaRKuZffp3OmuRNsKABjMLJmIWM2YaQ/wPmC2c2191ovGJkzx8r1w+UzszZb3teLYoaNQXTmrT/x+GB08uGg+VLn+4cRbbnuqbmRYo7AqGbrKrn2yq047pIekOJd7FNvjMRK1khNS5SkW8gVDh2dAi8Fkh1u0EFkk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784645663; c=relaxed/simple; bh=o7w7siPLQORZZFzNQnYMbQ9SCOa0EdaUN8YHwqTpwXk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=igmf6iH0qdFiUe1Y1899ZZswcf3CNPUFx8ny0aF2qzWG/5YfyUTdXt3Xbs+UlKEh0FwZPdilnwEP9tDA466jEnr8G+llNUqGZE65t8Itifxabrr1N12Mc2qa6C1o4vgzXzWlZZdjUiu04OG4PHvHhFAv5s7JjULo2sPtlEUWFFo= 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.20251104.gappssmtp.com header.i=@kernel-dk.20251104.gappssmtp.com header.b=g30IrdXC; arc=none smtp.client-ip=209.85.167.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.20251104.gappssmtp.com header.i=@kernel-dk.20251104.gappssmtp.com header.b="g30IrdXC" Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-4a43c2a126fso4304084b6e.3 for ; Tue, 21 Jul 2026 07:54:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20251104.gappssmtp.com; s=20251104; t=1784645660; x=1785250460; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=L6X3u2rc2tTqgs5eIuvvmqbkRqItWjduEZ4GfSwIM4k=; b=g30IrdXCpW1hc/wU4pEES15R5MDKdBs0uB4gUgrZhoKnhJr42dbdY2/MseOxK54QBT kY2H+kICFFCypF2YD6TWm3LyVm3W2GmwhjlVbygjc+4OY0C/ZEPdoQeLqwxvdKbmRvnl wh+5kMNP54XqJdEsDa5LH/YEJXdLxSpegCdz45ITSF0SAxv6iJCzJsQHRiYnHqX0UAyz HN9QaR/365QgX3N8/XEkN1TVpBdljkP2WFzyOp2NZ8nJpd9g43kAZh4bi6OXgUAGKlOa N5NkyUBc+UnlHKlfXemKiO6cQl4p+QCmEJ1nrBaf8/qV79YKmxtEsu0XmAL0biDVPOJr ze6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784645660; x=1785250460; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=L6X3u2rc2tTqgs5eIuvvmqbkRqItWjduEZ4GfSwIM4k=; b=m3m4ToOjgtT02yGW5RoMQWfa6B6w4VNYG4T8hT8OHX/cpYqZV7xZuaOs0zfv+nT8w5 rHQYO2IH/iK8V2+zUzj20dqz1gjClUi3sRuw755N7cIiu3I2IPtkxAA/z0XuT78aBvUq Em+xwL1NhorxCxhtBPrj0SRepkHZykWjfhO/b8Q4/nsHW0NOcC9ZdJMnsWb8+PM0CnhJ n0Z0OgwSV2wPKkeJjwW9lpQQ8XaJ7cgdR7yFXtcIFCKM/NnYzO6ZJTqDMC76w+iCFqMn T8sT2jGWLfF+EhMJOvsQ46sWCL2Dwk38YQvReyRwXHNccq6jRAHvqdnvZvAhl2YE1oMK ovzA== X-Gm-Message-State: AOJu0YzbAps6Jdzx4JfdfbqXCiVrVvtD5Pr1rwlbaGo4U+FBCWGGN9fo sYyjBaKbRyjQGGikZUUsp7vBQFQYrE0QpZ12MKzWWQe18mmy7a3uIar4esLpumZsxLM= X-Gm-Gg: AfdE7cmfDHvZTvapmnhiesTU90kmX8Yql2L+OL3VuMgPdNNOSTZNESTscUXD9svEK0b ZqZtq5iaA60suhP1jhbW7jV91i0FmMt9kOuWbbbIFl2fVVM9sGJuLYK37EFQkdFKuTqDBPC8/bM WvD5lP5KZ06Rx5u7OM4WaaeyZf/8TJ58c7xYz6bhJFiZpu1WURjzK8zqDdD04NmFH7yuuSwwLOu Ij7RV0sYoqYNKL2AU7u5oEINxiunxrBjzjOwHaieMG4IgAPkCc6eusTEvd85YKU+trjdsr28YaJ 8yXQuIxGgQNypGlS9/VJEcsonwoB8gOQ/cFnDtZvAzWoa12thdPJYHlgSLYbBFDMz7DxkX3nxWK rRZJAd/7inXQE5Dw/d82Ft4gzIbko1wffADODkklCxJl629xZmvqoKv0nDTbHMNoUnZy8hRK/4s 6TdQXdKyqdVzQp3G7h2VE5OCnfGQICG8zykHOePyegZHw1OE3JaBEW23NFWOZ4 X-Received: by 2002:a05:6808:4fca:b0:495:4a22:f29e with SMTP id 5614622812f47-4a4d031b280mr12987232b6e.25.1784645660242; Tue, 21 Jul 2026 07:54:20 -0700 (PDT) Received: from [192.168.1.150] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4a4d3cae815sm10163636b6e.10.2026.07.21.07.54.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Jul 2026 07:54:19 -0700 (PDT) Message-ID: <0f1fa2f1-34d9-4ee1-8938-50703f684ae3@kernel.dk> Date: Tue, 21 Jul 2026 08:54:18 -0600 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/kbuf: fix UAF in buffer selection when access_ok fails on expanded iovec To: Aayush7352 , io-uring@vger.kernel.org Cc: linux-kernel@vger.kernel.org References: <20260721095711.80711-1-aayushdixit924@gmail.com> Content-Language: en-US From: Jens Axboe In-Reply-To: <20260721095711.80711-1-aayushdixit924@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 7/21/26 3:57 AM, Aayush7352 wrote: > From: Aayush Dixit > > In io_ring_buffers_peek(), when the buffer ring is expanded > (KBUF_MODE_EXPAND), arg->iovs is set to a newly kmalloced array. > If access_ok() then fails on a buffer entry, the error path kfrees > the new array but does not restore arg->iovs to the original value > (org_iovs). arg->iovs is left dangling and will be reused on retry, > causing a use-after-free when the caller retries the buffer selection. > > Fix by restoring arg->iovs = org_iovs after the kfree on the error > path, so the caller's state remains coherent on retry. You sent this twice, replying once for both: this is bogus. If your LLM thinks it found something, have it write a reproducer. Then YOU reproduce, and then you can report it. Don't waste our time with garbage like this. > Fixes: b3e0216c97e3 ("io_uring: add buffer ring support") This is also bogus, this sha doesn't exist. -- Jens Axboe