[Devel] [PATCH RH8 5/6] memcg: enable accounting for posix_timers_cache slab

Vasily Averin vvs at virtuozzo.com
Mon Apr 12 13:26:55 MSK 2021


This patch enables memcg accounting for posix_timers_cache.
Unprivileged user inside container may create multiple interval
timers using timer_create() system call.

https://jira.sw.ru/browse/PSBM-120694
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 kernel/time/posix-timers.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index 95f4446ba762..94531d2cffb5 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -318,7 +318,8 @@ static int posix_get_hrtimer_res(clockid_t which_clock, struct timespec64 *tp)
 static __init int init_posix_timers(void)
 {
 	posix_timers_cache = kmem_cache_create("posix_timers_cache",
-					sizeof (struct k_itimer), 0, SLAB_PANIC,
+					sizeof (struct k_itimer), 0,
+					SLAB_PANIC | SLAB_ACCOUNT,
 					NULL);
 	return 0;
 }
-- 
2.25.1



More information about the Devel mailing list