From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (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 CCDC322A4CC for ; Tue, 10 Feb 2026 00:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770683371; cv=none; b=seX8yTC+/WPyC+VbV8XUZJ6F1vjz2zTTPVPAkR+cMmXxvdEnGNNMzVWgx/9gVbGuc9mstms+TT2PkGPiJ2UuPdgTlbrgdrBZu/FVtAEyaY6huNDzug5f7/aFzkNYT/Jj+KZ9NO8sgn6/OuPwgzSv3c1kmZkTXVT8bpTfwAQic6M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770683371; c=relaxed/simple; bh=QkYEXlLgFiLfYsdbBUxkHnpm64IBcci0n3arrJTjZQA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jBiPB9gr/prDw41XyuzAVL0cKm85Zmy2xhXjSst+UMZi+V5JS3cwatF2eTJWwMxIQh8doG6/ekyiaJ2pCONhlFUn4wK0LJV3OjwgucKibQW2BvNSNy6RXhSmqDijnth00XfJ5nl7TVI2Swb/zx48bumMGxiU15pZAHHX9W8jlUM= 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=HG5UFVJN; arc=none smtp.client-ip=209.85.160.180 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="HG5UFVJN" Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-503347e8715so43366781cf.2 for ; Mon, 09 Feb 2026 16:29:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1770683369; x=1771288169; darn=lists.linux.dev; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=x6h4j6WhKvTbDaZfOUKYNWWIjZl7N5IPl8TkLFVZwN4=; b=HG5UFVJNyZkOgPKs4cGrSKdhUpCkkbRySsBGXFDnXD3LKXFVEREpyecnvcLGBtyQEb aWYn3AwhRjVF5c/iUsE9OV3vvojfivNg+5FLeTVYvou8jFIaSK2CUsetHAMiKYzw6yTI vINpdOvDkAWr4I9B79AOZHAJGWU77sxoc7YfhcSF1wGbXBpb4cZfbOMTzrTqtRkR50T+ heA6Dg7YR/tumSlWCaumk1mtV3J7/dJnC/pk/j7ju2rxAy44MOxa3IjsSSxul0TOiVoJ B4jE9R3MkRM46ceWu3PcuwBkznUHtZ3+zl7tksU/ewb8TIUcTIBHr4rVnwRB4Bw9TMwo ySJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770683369; x=1771288169; h=in-reply-to:content-transfer-encoding:content-disposition :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; bh=x6h4j6WhKvTbDaZfOUKYNWWIjZl7N5IPl8TkLFVZwN4=; b=VyotNLm3fW0BdhPupGy1z1Kuy8LeFeBPYWYmNlQiVJSlctkhXohAIgOMGKIluOT7Di 4DnmSiByzZvGOvsAW4CfeLHOeLfB1H3nMCFl5YEomAJ/cCV5+kyNDKJn6i5/SNhB2ptl qZdUGqMUVQCLRZCDstaycBmmt67gBa3PC4hqH28ytEzy1m50pjTPALdiRkKCzg8vbVeo L1ONLj4T1NK8IuOARBKEYLy8v/lGawPO3PMAGhYYiVZ5H79cFHdyqJ8aYOnmtXdFta8Y G9/11wsJODetpzni89keBOe+SYsdoHqhrVn1++BnFmP8XjGUprsp86va/SeIBStE0++y 0q4A== X-Forwarded-Encrypted: i=1; AJvYcCUuEkja8JL7Q5aL4CN/vJgo4AQ42QC3hP2tlIqj6uXbg7KZ9+r4wMn5TyaseY2fTnF0T17XLcw8R2lf@lists.linux.dev X-Gm-Message-State: AOJu0YxH74vInTJ3UQHVSgMh760/IXlSVfsYPW7D0vV1S3ArJt8CW7QY UQn1vmo3dPqcjWHQAHrHf3ywqWRfvIkaI86WRJ4H0nmxcm6KMkuISvSraqGHlf5oMbQ= X-Gm-Gg: AZuq6aJtckC9jcbuk3jXM0JxPMUOKc6CIYALDudVBAse7UkzCO+ComKbnBo6OhBzob+ ZTeuWdZsDmcXX+f8ns8MwyabAn2FPfVxjQomY1MqhMNzzEDnJ2hDCo4jUqbIv3DSwqBX36gQ6ab qc3PC6tjTJtLMurBQpxMNlyzYkzDurdCWVcytZibfU1P2L9TneYo/eBRb11+HWnnTK5BMRs95ke Z31c6WVgsl9F7ieP2D+83qGQNYV5p+W8AZuo2P8NLixt6k2zU5B/q2/RW2E7Xp9F4kLwWocb7YY BMemGR8ftb0dQqejsCqLi8XibJ0AXcPzF3bhTWw2JH+15KpPhhbnjFNNEcOtbVw0GiU9AyLwKuC A0VSxGRx/8jpcCLquK4OYxa7+Jcp7Nb0NceH1Z/fw04eYxppgWlNaTh6ceef0iG6Z3+1pEG0Xos 5gSqzl5KhsLvM7pxsY6Io0ZS+B9jW57L6laceEzOrPHc4vYeqTs3rK7o9gLtR52rk/nOo8mkvV/ y56jFI= X-Received: by 2002:a05:622a:54:b0:4f3:438c:71 with SMTP id d75a77b69052e-50639889de0mr182445181cf.24.1770683368674; Mon, 09 Feb 2026 16:29:28 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-112-119.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.112.119]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8caf9a157ddsm979856985a.28.2026.02.09.16.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Feb 2026 16:29:28 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1vpbd9-0000000GngP-1JAF; Mon, 09 Feb 2026 20:29:27 -0400 Date: Mon, 9 Feb 2026 20:29:27 -0400 From: Jason Gunthorpe To: John Stultz Cc: Jiri Pirko , dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, iommu@lists.linux.dev, linux-media@vger.kernel.org, sumit.semwal@linaro.org, benjamin.gaignard@collabora.com, Brian.Starkey@arm.com, tjmercier@google.com, christian.koenig@amd.com, m.szyprowski@samsung.com, robin.murphy@arm.com, leon@kernel.org, sean.anderson@linux.dev, ptesarik@suse.com, catalin.marinas@arm.com, aneesh.kumar@kernel.org, suzuki.poulose@arm.com, steven.price@arm.com, thomas.lendacky@amd.com, john.allen@amd.com, ashish.kalra@amd.com, suravee.suthikulpanit@amd.com, linux-coco@lists.linux.dev Subject: Re: [PATCH 4/5] dma-buf: heaps: allow heap to specify valid heap flags Message-ID: <20260210002927.GC943673@ziepe.ca> References: <20260209153809.250835-1-jiri@resnulli.us> <20260209153809.250835-5-jiri@resnulli.us> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Feb 09, 2026 at 12:08:03PM -0800, John Stultz wrote: > On Mon, Feb 9, 2026 at 7:38 AM Jiri Pirko wrote: > > > > From: Jiri Pirko > > > > Currently the flags, which are unused, are validated for all heaps. > > Since the follow-up patch introduces a flag valid for only one of the > > heaps, allow to specify the valid flags per-heap. > > I'm not really in this space anymore, so take my feedback with a grain of salt. > > While the heap allocate flags argument is unused, it was intended to > be used for generic allocation flags that would apply to all or at > least a wide majority of heaps. > > It was definitely not added to allow for per-heap or heap specific > flags (as this patch tries to utilize it). That was the mess we had > with ION driver that we were trying to avoid. I don't know alot about DMA heaps.. On a CC VM system the shared/private property is universal and applies to every physical address. Not every address can dynamically change between shared and private, but every address does have a shared/private state. By default userspace process generally run exclusively in private memory and there are very few ways for userspace to even access shared memory. >From a heaps perspective the API would be very strange, and perhaps even security dangerous, if it is returning shared memory to userspace without userspace knowing this is happening. I'd advocate that the right design is for userspace to positively signal via this flag that it wants/accepts shared memory and without the flag shared memory should never be returned. Even if the underyling heap only has shared memory in it (eg it is mmio or something). Otherwise making it implicit, perhaps based on heap name, sounds very tricky for userspace to actually use fully securely. Again, I don't know alot about heaps, but perhaps the missing part here is that on a CC system all existing heaps, other than the one using normal system pages, should be disabled for now. They can come back once they are audited as to their shared/private state and respect the new flag. Another view is to ignore this affirmative handshake and just make it implicit on something like the heap name and hope userspace lucks into something that works for it, and doesn't accidently place, or become tricked into placing, sensitive information into shared heap memory. Again I know nothing about heaps, but this is a fuller picture of the security sensitivity and what to think about with heaps and CC VM systems. > Now, there has been many discussions around "protected buffers" (which > doesn't seem to map exactly to this confidental computing primitive, > but sounds like it might be related) I'm not sure what protected buffers are, but this CC VM shared/private (or encrypted/decrypted) is a core kernel property that applies to every physical address in the CC VM. I assume protected buffers are something more platform specific and hidden? > But, it seems like the use case here is still far too narrow for a top > level allocation flag. CC certainly is a narrow use case, but within CC I don't think it is narrow at all.. Jason