Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp473810pxj; Thu, 3 Jun 2021 11:09:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznx1mMoVsiYiH/MLpXVwGA/Fev7VJSvXSez4blX37B/hLi1R0dyb6SxF8t68KKiA6POoBj X-Received: by 2002:a17:906:a245:: with SMTP id bi5mr611630ejb.316.1622743778428; Thu, 03 Jun 2021 11:09:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622743778; cv=none; d=google.com; s=arc-20160816; b=LGwaI+nxSnqYuLsbG3HGgAMe0MH4IXTPl+fM65EJpPmRk2Bl+RD2KMkZvtlRhgX37V Sfc/g9E5I42Z+HFKinv4zpg1xBF3ZIQgJlnPS3IeTkReYTFSmfUwgxETertN0vp+Hyl8 2gCYbudl5AF/v/MQanZfsFsMJHs2NKTCsIRfj01Qh351kWOdDWwkCXtyrN0nZFvUf2oV ilYJDaNFutONSNuiJIcIP0svKJ9NEntWYBxGZCCf6h16KKsTvbSrPwttkPF+QGGJvuLd 9Xs31VFj1vE/1wEezBpV4IllULp4rEeVhBDBOf6LXAMAYID4jb1giVAV1U11a14I2SlT j0iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=L7JL5l0QHtqSsOPix17Y5ib8SywC0opDRoDXdkot+QY=; b=UJY1++pjWMqFYMWr7jMIyw+CQLBdgglR1jmBAqTBUElroKUfiRs9c1tiSwn5YHhGPb Dd6v3ajSKhU9MBF7Ucr377KSDhfFaRZIsLj4/Q0I+t+Ufjp86n+aUXucmr/Wn6lyAiVr 9csFonyl14rQk5iJM0hDueIpTw4tOq+3eGK/QCaH1CuZR62fP3/5Tx10ie6rIwOVJtXl xfuQBvBuEYQd4xSeoNmdEBeInnXuuUgpS3X1tOdgEwJVND9qLG0moMXQMaIu5NjcfO0A 8a9qWBqeu4XQ5bZIr3dCRe/35vq3UF50RKZS4j/p3EjosnPSRgeHJUHsiufEkQ3nqUIl kAYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@anarazel.de header.s=fm1 header.b=fnJjmEBz; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=HXkckYBe; 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 u20si2890413edv.439.2021.06.03.11.09.14; Thu, 03 Jun 2021 11:09:38 -0700 (PDT) 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=@anarazel.de header.s=fm1 header.b=fnJjmEBz; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=HXkckYBe; 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 S230389AbhFCSIB (ORCPT + 99 others); Thu, 3 Jun 2021 14:08:01 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:48499 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbhFCSIA (ORCPT ); Thu, 3 Jun 2021 14:08:00 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 937CC5C0072; Thu, 3 Jun 2021 14:06:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 03 Jun 2021 14:06:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=L7JL5l0QHtqSsOPix17Y5ib8Syw C0opDRoDXdkot+QY=; b=fnJjmEBz2x+tbWb1S1R9JTR5zOjX6A02txQWKMzz7gL kmdrh+hUUZKNMNExbJF5KlmSLzlUy3UhgUVkB7HaIZ2GsowHTUyE8dYF99CyUc0C b0KeFg+HmDt7yq3ADcvYn+uzva+E2aW9YhUgklFjTLVVAklOo5duuT1xZu+0wjyW EtnzOuUwyX9KzdbGZyPURi3pke2y5K9p8wmpvegCiymO26C78OQ/byzS+XD8uQkD bnqguVTejqpF1gooU0Nj4FENRd0FStEWLp2MdU73qq/DWqiC5zcOlM2XGnnjRWGV NZv/OHTeCB4QV6A9DrBjb6q47xiAzatkPCqTYCEW+kg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=L7JL5l 0QHtqSsOPix17Y5ib8SywC0opDRoDXdkot+QY=; b=HXkckYBehCeHod1L6gETOT rNR82hjv9NHeB1BYmLpKA7CzP3Z6W8qqwD6fm51OLKFjiEavyd7Vdx43t59YZb+V SY4uZmN4VVDTkLZ3oRiZsAuyMkqepa0/033eLcJ46Br/MbnKtkfCBweiJxxZsRVC gOmNkcXykBHrOEP0DRd0A3SIAv6x/wupk8/pxNAk7kul3YYRQFcE2mXXi8Jgow75 Zoy8NK4a7EEnaSGEi3zaRHmRXD5nxW9wy1fUiVal+8tQz324onnEluPcQTSJkg++ e6FFo8idEKyWpd1mBa6YwtxT5shx/z7vKWty2vSJv/OHYU0/un4wE+Nwc2Ekp7fw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdelledguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepudekhfekleeugeevteehleffffejgeelueduleeffeeutdelffeujeff hfeuffdunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 3 Jun 2021 14:06:13 -0400 (EDT) Date: Thu, 3 Jun 2021 11:06:12 -0700 From: Andres Freund To: Pavel Begunkov Cc: Jens Axboe , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Memory uninitialized after "io_uring: keep table of pointers to ubufs" Message-ID: <20210603180612.uchkn5qqa3j7rpgd@alap3.anarazel.de> References: <20210529003350.m3bqhb3rnug7yby7@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2021-05-29 12:03:12 +0100, Pavel Begunkov wrote: > On 5/29/21 1:33 AM, Andres Freund wrote: > > Hi, > > > > I started to see buffer registration randomly failing with ENOMEM on > > 5.13. Registering buffer or two often succeeds, but more than that > > rarely. Running the same program as root succeeds - but the user has a high > > rlimit. > > > > The issue is that io_sqe_buffer_register() doesn't initialize > > imu. io_buffer_account_pin() does imu->acct_pages++, before calling > > io_account_mem(ctx, imu->acct_pages); > > > > Which means that a random amount of memory is being accounted for. On the first > > few allocations this sometimes fails to fail because the memory is zero, but > > after a bit of reuse... > > Makes sense, thanks for digging in. I've just sent a patch, would > be great if you can test it or send your own. Sorry for the slow response, I'm off this week. I did just get around to test and unsurprisingly: The patch does fix the issue. Greetings, Andres Freund