Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp105895iob; Mon, 2 May 2022 14:20:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIeZHyP3eF7OmGb+TDYqL8Nb9LApPzopNehyDopvz78RvZhAKvqrWrMSbkw5KOeqmeqbqG X-Received: by 2002:a17:902:e054:b0:15c:ed0d:f13f with SMTP id x20-20020a170902e05400b0015ced0df13fmr13763010plx.76.1651526415922; Mon, 02 May 2022 14:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651526415; cv=none; d=google.com; s=arc-20160816; b=Ya6gWBulGBSLIYrtnoUAe3SAsxrEHL7ie4L5mjDRjc0hI+/ZBmEoALIZYS2yi5mIyH 8iELCx2QpscYGSi3Gx7JMxR/s9bfKTZNiO7VFF87Gchb05m1z57G79qC3/Iq0ieAfG6s ktMPEVS9lsM4F2LR+3DFmXV/osQtUd6Tqw3DGxbRMjIrNtTREy+nltUhn0JQG0SxKU6C AURch9uCTHfszMuyKchLVMoZKWukWQRYb3hEPgiLMt/+ZnQtVI0wHmurh8+g/Xg22ZEX JGwApamuC4bJaiaW00p6q7VXn+LMs/7xx156jpkudoHWjnjVBwrR1aTBNgxuRd7KUGuB 8amw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=LqkX6XBeIW8TsZdpLdtzQP+p29rZ0uf9pRgwD7D0pIM=; b=kUj+szjExeFPn99LPt7vpQA5xXoiRoXz8F0akVJ9ivovFAc3TtUhku9rv3c1HD6DgH 10wh1nqxk+wO5n+x4BGlbUMh7YsnZM3cqTAVIYvh5APaIWUtyBvT+S6X5ghTW5wrivOi GCVaZC1UH8FHbwdWbzwVIh5Uy0Ar5+o6/lV3ctei+o6iXGDL2woCEdyQ5gL4ibE6GjEG dAFbOuzfOJxID0CSmFlygFtwTerCxruamLuTqZUtblfiX4b64wMw/esaNU0XEwrukl/b ldQO+lTsqawmKW2VZbiyrQ9U07AKtBo3Eh/oM6kin7u+LBIUJfVdT9x2mmzu3RzUufH7 UxKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=mpzLDLmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rj1-20020a17090b3e8100b001dc2bd0ee2fsi325839pjb.156.2022.05.02.14.19.57; Mon, 02 May 2022 14:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=mpzLDLmT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359485AbiD2MvQ (ORCPT + 99 others); Fri, 29 Apr 2022 08:51:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237696AbiD2MvQ (ORCPT ); Fri, 29 Apr 2022 08:51:16 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70BC3C9B77 for ; Fri, 29 Apr 2022 05:47:58 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id h12so7029069plf.12 for ; Fri, 29 Apr 2022 05:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=LqkX6XBeIW8TsZdpLdtzQP+p29rZ0uf9pRgwD7D0pIM=; b=mpzLDLmTVzRoHeGa90/5vPbjvJXWXjW3wYCr4FQCoM4lTyqQ2gpD4xho2hxFKlU1iz jbu8guu6c20Ip9M7TGYljqL+OWrKyDTDvZxz38Xt4FbzybJHcLW9WcSgiNtVr3lt6eNd Jd0R2tH+pMK3iWVAD0uIoNWUbxmeJdLxJN7beHE7+qgfNikXnFvknzEt04u4l5yw41yz syhEx6JVjTlimyLM2r645sxW20vr5uedumqSGiaNHF+eeoUpg1kmzpUER0m8YyXWMGZy K5wGtH6nlgRx6JOVBUDtD9jFX6Syy+DjP1Qo8fC6fCY/aU0uoa4zXyX7Tav8CFrRhXXp YCxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=LqkX6XBeIW8TsZdpLdtzQP+p29rZ0uf9pRgwD7D0pIM=; b=ImyxUxrIuboGywh+ga/ZRR3SYpsdz9U5JyrYE2k7RXfWcWMpSduD1qJo2nDgmU9JiE SCcLW6sRvj6FVkZQkLKDlye/Pvul2wl4TlfOetqPNV6Znt+noCzR+58Ycp1l+il9Fn8r 6dG4NRS3KB2V/WS6xTS5X6y6lj4SiaZ9VAQRPvjVmUcOFLYjfavGWa3cq/txcOJkMVe8 lQ2M2zjye1ikdsWpShjVdjuEUeeCkglttowHL+Z8a30ejl9KeLCsomnskBaDyxoeH5Ew uO1hsgtsF27xJZrEMnlmP8qgLLOMaWatkEXvpZJwYVcvrO+oJ+diESRoYB55R13BTX/Y x5Tg== X-Gm-Message-State: AOAM53387kskigRdUMOZF7JiNCXJhPd+X2UpErmUsteiuXUZEVc8r+7G g8LZQj0pFVv9cMCbSl7cjAF31g== X-Received: by 2002:a17:902:ecd2:b0:15b:618a:2a8f with SMTP id a18-20020a170902ecd200b0015b618a2a8fmr38429433plh.140.1651236477929; Fri, 29 Apr 2022 05:47:57 -0700 (PDT) Received: from [192.168.1.100] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id u19-20020a63b553000000b003c14af50616sm5885047pgo.46.2022.04.29.05.47.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Apr 2022 05:47:57 -0700 (PDT) Message-ID: <8f8d07c1-9276-df86-f1dc-3d272d4ab91d@kernel.dk> Date: Fri, 29 Apr 2022 06:47:55 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v1] io_uring: Fix memory leak if file setup fails. Content-Language: en-US To: Noah Goldstein Cc: asml.silence@gmail.com, io-uring@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220429004244.3557063-1-goldstein.w.n@gmail.com> From: Jens Axboe In-Reply-To: <20220429004244.3557063-1-goldstein.w.n@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/28/22 6:42 PM, Noah Goldstein wrote: > If `get_unused_fd_flags` files fails (either in setting up `ctx` as > `tctx->last` or `get_unused_fd_flags`) `ctx` will never be freed. There's a comment there telling you why, the fput will end up releasing it just like it would when an application closes it. > I very well may be missing something (or there may be a double > free if the failure is after `get_unused_fd_flags`) but looks > to me to be a memory leak. Have you tried synthetically reproducing the two failures you're thinking of and tracing cleanup? -- Jens Axboe