fork, memcg: fix cached_stacks case
Subsystems (6)
PATCH 1/1 fork, memcg: fix cached_stacks case
Commit 5eed6f1dff87 ("fork,memcg: fix crash in free_thread_stack on memcg charge fail") fixes a crash caused due to failed memcg charge of the kernel stack. However the fix misses the cached_stacks case which this patch fixes. So, the same crash can happen if the memcg charge of a cached stack is failed.
--- kernel/fork.c | 1 + 1 file changed, 1 insertion(+)
kernel/fork.c +1 -0
@@ -216,6 +216,7 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node)memset (s->addr,0 ,THREAD_SIZE ); tsk->stack_vm_area = s; + tsk->stack = s->addr;return s->addr; }
Signature · 1 line
2.20.1.415.g653613c723-goog
Quoted 6 lines · Shakeel Butt
Commit
5eed6f1dff87("fork,memcg: fix crash infree_thread_stackon memcg charge fail") fixes a crash caused due to failed memcg charge of the kernel stack. However the fix misses thecached_stackscase which this patch fixes. So, the same crash can happen if the memcg charge of a cached stack is failed.
Quoted 8 lines
Fixes 5eed6f1dff87 ("fork,memcg: fix crash in free_thread_stack on memcg charge fail")Signed-off-by Shakeel Butt <[email protected]>Cc Rik van Riel <[email protected]>Cc Roman Gushchin <[email protected]>Cc Michal Hocko <[email protected]>Cc Johannes Weiner <[email protected]>Cc Tejun Heo <[email protected]>Cc <[email protected]>
Ups, I have overlook that. Thanks for catching that.
Quoted 19 lines
--- kernel/fork.c | 1 + 1 file changed, 1 insertion(+)kernel/fork.c +1
-0@@ -216,6 +216,7 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node)memset (s->addr,0 ,THREAD_SIZE ); tsk->stack_vm_area = s; + tsk->stack = s->addr;return s->addr; }Signature · 1 line
2.20.1.415.g653613c723-goog
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 9 lines · Shakeel Butt
Commit
5eed6f1dff87("fork,memcg: fix crash infree_thread_stackon memcg charge fail") fixes a crash caused due to failed memcg charge of
the kernel stack. However the fix misses thecached_stackscase which this patch fixes. So, the same crash can happen if the memcg charge of
a cached stack is failed.Fixes 5eed6f1dff87 ("fork,memcg: fix crash in free_thread_stack on
Quoted 8 lines
memcg charge fail")
Signed-off-by Shakeel Butt <[email protected]>Cc Rik van Riel <[email protected]>Cc Roman Gushchin <[email protected]>Cc Michal Hocko <[email protected]>Cc Johannes Weiner <[email protected]>Cc Tejun Heo <[email protected]>Cc <[email protected]>
Good catch. Thank you.
Signature · 1 line
All Rights Reversed.