Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] Missing Memcg Accounting in SVM Caches
--

commit c7235f541841c86e76bfeba1fd000ec628328f01
Author: Honglei Huang <[email protected]>

drm/amdgpu: add SVM core header and VM integration

This commit adds the core header file amdgpu_svm.h defining the data
structures, public API, and caching macros for SVM integration. It also adds
an experimental SVM pointer to struct amdgpu_vm.

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_svm.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_svm.h
> new file mode 100644
> index 0000000000000..9884a1f834d67
> --- /dev/null
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_svm.h
[ ... ]
> +#define AMDGPU_SVM_ERR(fmt, ...) \
> +     pr_err("%s: " fmt, __func__, ##__VA_ARGS__)
> +
> +#define AMDGPU_SVM_KMEM_CACHE_CREATE(name, type) \
> +     kmem_cache_create((name), sizeof(type), 0, 0, NULL)

[Severity: High]
Does this hardcoded flag value prevent proper memory cgroup accounting?

This macro hardcodes the flags parameter of kmem_cache_create() to 0, which
omits SLAB_ACCOUNT.

If user-controlled structures like the SVM memory range tracking cache
are instantiated using this macro, omitting memory cgroup accounting allows
a containerized process to allocate unbounded amounts of kernel memory without
being charged to its cgroup. Could this bypass container resource limits and
potentially exhaust system kernel memory?

> +
> +#define AMDGPU_SVM_KMEM_CACHE_DESTROY(cache) \
> +     do { \
[ ... ]

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to