Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4723037ybv; Tue, 11 Feb 2020 02:07:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwIWwgiMlf4V4Nq2f51yytUDOecK1xD8PC4ZO68edhZ5Ou8gUP8Ufnnc+c7KEn2aMB2pA55 X-Received: by 2002:aca:1314:: with SMTP id e20mr2414810oii.112.1581415652365; Tue, 11 Feb 2020 02:07:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581415652; cv=none; d=google.com; s=arc-20160816; b=mWZCOhvoxthHPBZMiDoOHjQgmajBCOolazu5dI1OneT9sYCMesctd+ojrA3AGBNE/Q 3MAxKH1SGy8ppTvvnahImbBoye6Z0nNWBjDQLEST891Qcb2GiCjRkk4VCJpJOKq4kP+5 p+0legffk8tNzCIpryWbH1X2P3jWPc9NHhK92pYeZIYyy5gzHrIMyxq/sfDo8sa2D0bF HFdZP3RhcddoXrVLYPNQ78cDjzBHDiLHSoNKL0zW1M5pGkuUEc0B7kSEeitv0Ibr2Qjd XvEa2CgTX6XQqnZGJRGPEfBR0odOtDHVI9LkKKfbapWJDvY4K2fLddBmiuRehOVe7an7 uo5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:from; bh=qp09E3fVpA0wD1RB589U1jknfTGL3ylFNAeF2OhbulE=; b=t1E4x9livOp4aRMuH/l9Y2VvPYwTnNX/sZvKACRr77dg5sJlw/UUFIjXYuikdy6vvK cdXBr7nytgGjXpUvQxF4E2Tntd61qQi+eI3h5MwaHwKRuRfchiIzKLfuP9Xu5Odme19j CUu+KFiLOREr9e7zMKh+VeLTA1UaNg5/vU8fcrM4eFoD4dOZHLwVxyXBGgSb11L6PyA5 fGt6/TZbS8J6kPWCjP5QzbeKZzTGIt/AX/FIyTr/9z1VyveawmR5AdagW3IfwzIYTg5z 0pASpSHokVFbQeKcVEk0UQd+qIBoecB5T2P2c9oRBd3h+tay3OBYRJ1665OvVVe1R3Va s9rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z20si1363064oib.26.2020.02.11.02.07.20; Tue, 11 Feb 2020 02:07:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727840AbgBKKHL convert rfc822-to-8bit (ORCPT + 99 others); Tue, 11 Feb 2020 05:07:11 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:48723 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727264AbgBKKHL (ORCPT ); Tue, 11 Feb 2020 05:07:11 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-6-3p5GBDr0P_ySFL9gRCGzAA-1; Tue, 11 Feb 2020 10:07:06 +0000 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 11 Feb 2020 10:07:06 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Tue, 11 Feb 2020 10:07:06 +0000 From: David Laight To: 'Pavel Begunkov' , Jens Axboe , "io-uring@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] io_uring: fix iovec leaks Thread-Topic: [PATCH] io_uring: fix iovec leaks Thread-Index: AQHV3emh7zgsynhUKk2BR9GeKazohKgVyZ8A Date: Tue, 11 Feb 2020 10:07:06 +0000 Message-ID: <1255e56851a54c8c805695f1160bec9f@AcuMS.aculab.com> References: <03aa734fcea29805635689cc2f1aa648f23b5cd3.1581102250.git.asml.silence@gmail.com> In-Reply-To: <03aa734fcea29805635689cc2f1aa648f23b5cd3.1581102250.git.asml.silence@gmail.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: 3p5GBDr0P_ySFL9gRCGzAA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Begunkov > Sent: 07 February 2020 19:05 > Allocated iovec is freed only in io_{read,write,send,recv)(), and just > leaves it if an error occured. There are plenty of such cases: > - cancellation of non-head requests > - fail grabbing files in __io_queue_sqe() > - set REQ_F_NOWAIT and returning in __io_queue_sqe() > - etc. > > Add REQ_F_NEED_CLEANUP, which will force such requests with custom > allocated resourses go through cleanup handlers on put. This looks horribly fragile. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)