From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (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 378D93D9556 for ; Tue, 14 Jul 2026 12:22:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784031767; cv=none; b=am1HMEikAZ9B+NXz4YzlJdZbFRZorhw1GJsFwhjPQ42JxF988OmAOxJIDRN7x0/b6qYVV0M+z2nb4/sv5I7gdRUc+A5zsN138w+bjS8T5uTdt1a3/rd8oUHH2cgulTQPKtwfFscd0pP5k2Krn56sN1zg5IzXuMTplyVnoHo/hsM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784031767; c=relaxed/simple; bh=Gu04W+cCiiM26ZsyHUMdXjMPrm/Duv/aZB+CYp/Nq1c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BuEQ+L+/raqXGFJOctIxYSr695CZESY1xOq0bF/ubgHII1KrxZ+oHAmoBBIWDYkbrIQk872CFFJoZO7Hv401JFLPGFWOC8aNl1tTJ9i7DeEXVL5h/tJI/ZEFuATxaVi0RrWl3NkQ5pKWUNpWH+w4XSw5AHfwapjlT5PPYG5zpwA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=kXbSuiGs; arc=none smtp.client-ip=209.85.222.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="kXbSuiGs" Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-92ea24a2dbfso317290085a.0 for ; Tue, 14 Jul 2026 05:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1784031754; x=1784636554; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=5CIAv+UZ8t7s5h+WlDS73yJMkdztMQ3zXG2Fxq/to8M=; b=kXbSuiGsizaJGXnP5Oe10d3MmN6ZDiAdGtR2MPNJ1vRy5smGbDLppm2hUD/hE4rqd4 WijR9WOS40i+6nBD4RjrDWNfRrspbtfZqht1Vns+WDsFh4mxdQCT/wIa+4PFhElgQ4on jj4YtFlthd4AGtMZarD8Tk7xwGUecfLGEhFYVhLN6vdAjHKMW/PgHrGSchgkVMRTfOme VO3Y8nrYrYL2xD14FNxaLerz9QcyrB7VpG/BbRV2iCMcZaFuIGlvA+Quo98Wu9ImqfXg rlaNePbbMd2NzvQLK2zQiPZuKJImliERRpHt+Y3bNC8diF6RuUL4S02PN7jDPy0wx8Qm K9qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784031754; x=1784636554; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=5CIAv+UZ8t7s5h+WlDS73yJMkdztMQ3zXG2Fxq/to8M=; b=ZDrNqrZgKVrZnmWfyaLO9A8lAVS3N3RwyiMiHHYarHBjy8MYLIA48ZO8dZjbZzuzf3 Zds/BmDf8dm32tyct3PJNToOjFAfLuJvM9aC7mvoZw8XaGSA6bk91+Upv4P9tTtV8qOM fKI10iAJiS+vUJPiI87Y6plzQqqhWF587e1FsA4Rff7NAmIWoj6YIfkxcDCtMHpfp1nF hf9ISFRfp7bA0D25Z2kH7dJeW6dSy84SgmGpggyopNLa9Kw7o2a6a+CPs5pgQkdkywFc yhwDfsDMAfWmwJDtqGaFR3EhiZRupNIAG+c9o11W2PCkh5t7g0m8AuaCo761QpE2FSnf Q3cA== X-Forwarded-Encrypted: i=1; AHgh+Rq+kx9CQajWTXs/CpQZXMRdKySiwt4do9I8cdXtQCEiBdWDu8H+x+cK07nwzubsyqHLGVjtHSRSx8Tz3Og=@vger.kernel.org X-Gm-Message-State: AOJu0YymfniStapBTV2jJmUn1PQssTXAR7l8qs3ibz7H7TqgzdT2fwyh 0tSUx6ezy3CvBUgE4j3nB7MWVV9NgIsiOzZVQh0DdwrJ0dELGwcYseNZgPxEw1u4V/Y= X-Gm-Gg: AfdE7cnpcVp3kUbowR8UO5Bfmv4EYfyETXc9sXE2m2rhoMbUM3etk0ZZXFm0w2vA+oS 9VQYTpgU1UPYNBzhXHHTugPLASeCm7qpzxWGl2hh+kOrRmeaudNX5mYAiw6f66DHiPx0iAZU35K lUX4kyCkERmIbhEb3sNslNtOVoODXqeH7rmT27lFGl56xlfKazjo8cSM98A381oh994P6J0a7o9 jDVaj2ks5UIyrZAsnJf2YnbSTEuDgHyRBZguTNABgw2cD6rG8oID4YZtocNlUaoLnIFKYph5agQ Ulhnh9BlnHTY/C34rIV/zZQ56w48gxNRbgp83S9UdJh5TWY4eQnvjQ9X00ESGQsMm9jy4Dn+4Dd 8E4fKrR2Btd786uLiG3N3k/6I0RNk2WBahZ3lt8p3Da+Nu56K+QkydVdmPfjI X-Received: by 2002:a05:620a:7085:b0:92e:6bbf:966e with SMTP id af79cd13be357-92ef2cb202cmr1211484585a.45.1784031754284; Tue, 14 Jul 2026 05:22:34 -0700 (PDT) Received: from ziepe.ca ([159.2.72.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ffd82ea9casm164927486d6.42.2026.07.14.05.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 05:22:33 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wjc9g-0000000FRaG-0ohM; Tue, 14 Jul 2026 09:22:32 -0300 Date: Tue, 14 Jul 2026 09:22:32 -0300 From: Jason Gunthorpe To: "Aneesh Kumar K.V" Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, Robin Murphy , Marek Szyprowski , Will Deacon , Marc Zyngier , Steven Price , Suzuki K Poulose , Catalin Marinas , Jiri Pirko , Mostafa Saleh , Petr Tesarik , Alexey Kardashevskiy , Dan Williams , Xu Yilun , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , x86@kernel.org, Michael Kelley Subject: Re: [PATCH v7 02/22] dma-pool: fix page leak in atomic_pool_expand() cleanup Message-ID: <20260714122232.GE3133966@ziepe.ca> References: <20260701054926.825925-1-aneesh.kumar@kernel.org> <20260701054926.825925-3-aneesh.kumar@kernel.org> <20260713175433.GI3133966@ziepe.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Jul 14, 2026 at 09:05:25AM +0530, Aneesh Kumar K.V wrote: > Jason Gunthorpe writes: > > > On Wed, Jul 01, 2026 at 11:19:06AM +0530, Aneesh Kumar K.V (Arm) wrote: > >> @@ -115,8 +116,10 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size, > >> */ > >> ret = set_memory_decrypted((unsigned long)page_to_virt(page), > >> 1 << order); > >> - if (ret) > >> + if (ret) { > >> + leak_pages = true; > >> goto remove_mapping; > >> + } > > > > Truely these _set_memory_decrypted() things are an insane API. So a if > > it fails to decrypt it can be in any messy state? > > > > Yes, we could possibly try to encrypt the page again and, if that > succeeds, avoid leaking it. We might want to do that tree-wide in a > separate patch. IMHO it is a horrid API if failure leaves thing in an indeterminate state. For something like this I don't see why the arch FW implementation would be unable to restore things back to as they were on failure. But whatever, everything about set_memory_xx is really bad it could use a cleaning Jason