Hi Maxime,

Thanks for the suggestion — that makes sense.


Accounting the property blob allocation via GFP_ACCOUNT addresses the problem 
at the right layer by charging memory usage to the caller’s memcg, instead of 
introducing additional per-file limits or policy in DRM. This ensures that 
excessive allocations are contained within the offending cgroup and handled by 
memcg OOM, avoiding system-wide impact.
I agree this is a cleaner approach and will respin the patch accordingly.


BR,
Xiao




---Original---
From: "Maxime Ripard"<[email protected]&gt;
Date: Mon, Jan 5, 2026 18:36 PM
To: "Xiao Kan"<[email protected]&gt;;
Cc: 
"maarten.lankhorst"<[email protected]&gt;;"tzimmermann"<[email protected]&gt;;"airlied"<[email protected]&gt;;"simona"<[email protected]&gt;;"dri-devel"<[email protected]&gt;;"linux-kernel"<[email protected]&gt;;"w"<[email protected]&gt;;"security"<[email protected]&gt;;"kanxiao666"<[email protected]&gt;;"xiao.kan"<[email protected]&gt;;
Subject: Re: [PATCH] drm: limit property blob creation per file


Hi,

On&nbsp;Sat,&nbsp;Jan&nbsp;03,&nbsp;2026&nbsp;at&nbsp;10:25:29AM&nbsp;-0500,&nbsp;Xiao&nbsp;Kan&nbsp;wrote:
&gt;&nbsp;DRM_IOCTL_MODE_CREATEPROPBLOB&nbsp;allows&nbsp;userspace&nbsp;to&nbsp;create&nbsp;property&nbsp;blobs
&gt;&nbsp;whose&nbsp;lifetime&nbsp;is&nbsp;scoped&nbsp;to&nbsp;a&nbsp;drm_file.
&gt;&nbsp;
&gt;&nbsp;Currently,&nbsp;a&nbsp;single&nbsp;drm_file&nbsp;may&nbsp;create&nbsp;an&nbsp;unbounded&nbsp;number&nbsp;of&nbsp;blobs.
&gt;&nbsp;Repeated&nbsp;ioctl&nbsp;calls&nbsp;can&nbsp;trigger&nbsp;unbounded&nbsp;kernel&nbsp;memory&nbsp;allocation&nbsp;and
&gt;&nbsp;lead&nbsp;to&nbsp;OOM,&nbsp;resulting&nbsp;in&nbsp;a&nbsp;denial-of-service.
&gt;&nbsp;
&gt;&nbsp;Introduce&nbsp;a&nbsp;per-drm_file&nbsp;limit&nbsp;on&nbsp;the&nbsp;number&nbsp;of&nbsp;user-created&nbsp;property
&gt;&nbsp;blobs.&nbsp;The&nbsp;limit&nbsp;is&nbsp;enforced&nbsp;at&nbsp;the&nbsp;point&nbsp;where&nbsp;a&nbsp;blob&nbsp;becomes&nbsp;associated
&gt;&nbsp;with&nbsp;a&nbsp;drm_file,&nbsp;matching&nbsp;the&nbsp;existing&nbsp;ownership&nbsp;and&nbsp;lifetime&nbsp;model.
&gt;&nbsp;This&nbsp;bounds&nbsp;per-file&nbsp;allocations&nbsp;while&nbsp;the&nbsp;total&nbsp;number&nbsp;of&nbsp;DRM&nbsp;file
&gt;&nbsp;descriptors&nbsp;remains&nbsp;constrained&nbsp;by&nbsp;existing&nbsp;kernel&nbsp;limits.
&gt;&nbsp;
&gt;&nbsp;Signed-off-by:&nbsp;Xiao&nbsp;Kan&nbsp;<[email protected]&gt;
&gt;&nbsp;Signed-off-by:&nbsp;Xiao&nbsp;Kan&nbsp;<[email protected]&gt;

Wouldn't&nbsp;it&nbsp;make&nbsp;more&nbsp;sense&nbsp;to&nbsp;account&nbsp;the&nbsp;allocation&nbsp;in&nbsp;memcg&nbsp;by
passing&nbsp;GFP_ACCOUNT&nbsp;to&nbsp;the&nbsp;kvzalloc&nbsp;call&nbsp;in&nbsp;drm_property_create_blob?

Maxime

Reply via email to