Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2484487pxu; Mon, 7 Dec 2020 07:47:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJywHuuxBwsyim7gCHqnq90tiQwJx8tEYPLuiV869wWmfbovXSw43GR7EK9vpnZ66hCUVpyB X-Received: by 2002:a50:d646:: with SMTP id c6mr1147901edj.177.1607356021320; Mon, 07 Dec 2020 07:47:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607356021; cv=none; d=google.com; s=arc-20160816; b=Z3W1QNNqQRQ9cb9z/mTLazCFePI1rlJF6C5EiCm6/1/sJWyrOh5E9HbH1IC2nXzPvc Q0XipO/xXLmhIycdogoAlQ4Ea/cxsol/m2ZAus9EM2CkGH9pas0+VNOn+DruFUUBcUwN cc/1OnyCkce+g/F5Bi8iCwzY0bA5sT+aSVjUEua4YJO8kR/a74Sd0U/DAkGblMOhX6TE g7GRUeR03mCMSKMMGaR0HZmJyH15/NQxDHIIG/hfx6Lq+O6qZQvQknAgbZ4ltQW38wkl NJQxUDjv5jLefMEGOlAoFK+3tZLVVW5yCxoojH/u2dMa6RI3BVJbA5/r/q2zv9BVspzk gy+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject:dkim-signature; bh=KGuP04Yh5ZseJNv/4+3M6j57gxslXZrgP+sgHsyOAzo=; b=wiRDIISKdIVYwLTZ+YGfZzQ9DQfzuB3HCa+T0/B0o+RgrZxp+REvVs5mXgmuegouC/ hWjvhmzp6VvQw2dTJBpZmTBVUtFFFPaqA6RPJNDrs12HsAki2NhnPmbgD7P2ZeIfqVbs pzq69+cC7Qx6g0GQGme79C7IPlzWrqP/nL1PNU1QZoNcT2AGjTxKTTQFvZL3u0E+l5nI y7haOrcd527STd9z1lvEWnXUYMyey62/O/pCRrrP+F6VV7TtjejbbzEgz6BM4svZJjDC btvB61NMDfdc9OlpNuNcSu2IzhefFSFwqSXrZQj2Autku2H9efmUQRZuVbzFPlU3uAyn otkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=ICznjA1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p23si6687582eja.133.2020.12.07.07.46.37; Mon, 07 Dec 2020 07:47:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=ICznjA1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726607AbgLGPnH (ORCPT + 99 others); Mon, 7 Dec 2020 10:43:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726055AbgLGPnH (ORCPT ); Mon, 7 Dec 2020 10:43:07 -0500 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25488C061793 for ; Mon, 7 Dec 2020 07:42:27 -0800 (PST) Received: by mail-io1-xd43.google.com with SMTP id o8so13786643ioh.0 for ; Mon, 07 Dec 2020 07:42:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=KGuP04Yh5ZseJNv/4+3M6j57gxslXZrgP+sgHsyOAzo=; b=ICznjA1rFsrMyRf9e3LLtRhJfQ0qm9c1oCCwOJhPfwE2Xu9H1e9QG9LzeLCLEdv5Yz X54uDybUb/SL3RLSXbXFP2CCgyFBQtS7VYvLXphgjqqPiibzj6sf/SZ9gtrgcxxfSzTH c5bR/c/CD0R011J1OAjF7wmifZkQNbl+QPMyOmYs1HpSWBp6sOTV060iX14ZxMX3M5Ov 5HQ0VOXYbGHsTNFyHnGswcfvgz62MNTpvRv+FPLeOpsC8RFmibZNg6rS0pVp0Z153w+z fJKaWbr6oYMhZWROgqRoHbXANhGLwbp9vlBrRiK8IY2zES0C0rv+zBpxBWMq08baqVS8 9yPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KGuP04Yh5ZseJNv/4+3M6j57gxslXZrgP+sgHsyOAzo=; b=NWYQOLAY1M3wNQCn9hQhO2GZV4MK+ZIFMyzhvhNSaXivbh+9W/O8DqVLfz+z0L6gdM YOeis6lQHHl7mjuasDIJmcwpcInNnROa+XrGH+k30LcaiQCPdb7vYvd3FgnDWhPAgiWL kYSjgFOEotqBO6BWZbu19QsrXBXIEd5/Agf1HfaOFpOKwoc0f53tBa+u2A5OZPx3EOTP xx9U7xF5ZLGS0TdEmXRYSVJK1SE1N/oz69MdGOVFCsc5XjnFqGFv9nHGdh199ZYLUo06 9LLw/+kEHHhHVjrDMiZiYMNF0hBAYUaW516n/2W9C/X0WOxOboTpevPAzzFGMsNgzmBn YsBA== X-Gm-Message-State: AOAM532VBwRo+MylJknPZaYdqPk5N/FB6LDBJNcKKb3fsY/upp+GOW6Q qLzN0LPHH7vnvS+2wYoRMH9tjw== X-Received: by 2002:a05:6602:26d4:: with SMTP id g20mr9323995ioo.152.1607355746498; Mon, 07 Dec 2020 07:42:26 -0800 (PST) Received: from [192.168.1.30] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id x17sm7497915ilj.67.2020.12.07.07.42.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Dec 2020 07:42:25 -0800 (PST) Subject: Re: [PATCH] io_uring: fix file leak on creating io ctx From: Jens Axboe To: Hillf Danton , LKML Cc: io-uring@vger.kernel.org, syzkaller-bugs@googlegroups.com, syzbot+71c4697e27c99fddcf17@syzkaller.appspotmail.com, Pavel Begunkov References: <20201207081558.2361-1-hdanton@sina.com> <13bd991a-be45-6521-655d-74b8d810b714@kernel.dk> Message-ID: <848ad126-c4f7-6dba-24da-d7e29cbcfb67@kernel.dk> Date: Mon, 7 Dec 2020 08:42:25 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <13bd991a-be45-6521-655d-74b8d810b714@kernel.dk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/7/20 8:04 AM, Jens Axboe wrote: > On 12/7/20 1:15 AM, Hillf Danton wrote: >> Put file as part of error handling when setting up io ctx to fix >> memory leak like the following one. >> >> BUG: memory leak >> unreferenced object 0xffff888101ea2200 (size 256): >> comm "syz-executor355", pid 8470, jiffies 4294953658 (age 32.400s) >> hex dump (first 32 bytes): >> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ >> 20 59 03 01 81 88 ff ff 80 87 a8 10 81 88 ff ff Y.............. >> backtrace: >> [<000000002e0a7c5f>] kmem_cache_zalloc include/linux/slab.h:654 [inline] >> [<000000002e0a7c5f>] __alloc_file+0x1f/0x130 fs/file_table.c:101 >> [<000000001a55b73a>] alloc_empty_file+0x69/0x120 fs/file_table.c:151 >> [<00000000fb22349e>] alloc_file+0x33/0x1b0 fs/file_table.c:193 >> [<000000006e1465bb>] alloc_file_pseudo+0xb2/0x140 fs/file_table.c:233 >> [<000000007118092a>] anon_inode_getfile fs/anon_inodes.c:91 [inline] >> [<000000007118092a>] anon_inode_getfile+0xaa/0x120 fs/anon_inodes.c:74 >> [<000000002ae99012>] io_uring_get_fd fs/io_uring.c:9198 [inline] >> [<000000002ae99012>] io_uring_create fs/io_uring.c:9377 [inline] >> [<000000002ae99012>] io_uring_setup+0x1125/0x1630 fs/io_uring.c:9411 >> [<000000008280baad>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 >> [<00000000685d8cf0>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > Applied for 5.10, thanks. I take that back, this patch is totally broken. Please test your patches before sending them out, this cannot have been even put through the most basic of tests. -- Jens Axboe