copy_process(): Fixed jump logic error
Subsystems (4)
PATCH 1/1 copy_process(): Fixed jump logic error
After futex_hash_allocate_default() fails, the logic should jump to bad_fork_cancel_cgroup, not bad_fork_core_free.
Jumping to bad_fork_core_free would cause a siglock imbalance.
--- kernel/fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/fork.c +1 -1
@@ -2349,7 +2349,7 @@ __latent_entropy struct task_struct *copy_process(if (need_futex_hash_allocate_default (clone_flags)) { retval =futex_hash_allocate_default ();if (retval) - goto bad_fork_core_free; + goto bad_fork_cancel_cgroup;/* * If we fail beyond this point we don't free the allocated * futex hash map. We assume that another thread will be created
Signature · 1 line
2.43.0
Quoted 6 lines · Edward Adam Davis
After
futex_hash_allocate_default()fails, the logic should jump tobad_fork_cancel_cgroup, notbad_fork_core_free.Jumping to
bad_fork_core_freewould cause a siglock imbalance.Signed-off-by Edward Adam Davis <[email protected]>
If it's still only in -next (which I assume when looking at the Next tag), into which patch should this fixup get squashed?
Or is this already upstream and we want actually Fixes: and CC stable?
(staring at current master, this seems to be an upstream problem?)
Quoted 9 lines
--- kernel/fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/fork.c +0
-0
kernel/fork.c __latent_entropy struct task_struct *copy_process( · line 2355
Quoted 8 lines
kernel/fork.c +1
-1@@ -2349,7 +2349,7 @@ __latent_entropy struct task_struct *copy_process(if (need_futex_hash_allocate_default (clone_flags)) { retval =futex_hash_allocate_default ();if (retval) - goto bad_fork_core_free; + goto bad_fork_cancel_cgroup;/* * If we fail beyond this point we don't free the allocated * futex hash map. We assume that another thread will be created
Makes me wonder whether we would have to undo anything the sched_cgroup_fork() did, or if that cleanup is implied in bad_fork_cancel_cgroup. Without digging too deep into the code, I assume the latter.
Signature · 3 lines
Cheers David / dhildenb
Quoted 6 lines · Edward Adam Davis
After
futex_hash_allocate_default()fails, the logic should jump tobad_fork_cancel_cgroup, notbad_fork_core_free.Jumping to
bad_fork_core_freewould cause a siglock imbalance.Signed-off-by Edward Adam Davis <[email protected]>
Sebastian already fixed this and it's in tip: locking/urgent
https://lore.kernel.org/all/[email protected]/
Quoted 17 lines
--- kernel/fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/fork.c +1
-1@@ -2349,7 +2349,7 @@ __latent_entropy struct task_struct *copy_process(if (need_futex_hash_allocate_default (clone_flags)) { retval =futex_hash_allocate_default ();if (retval) - goto bad_fork_core_free; + goto bad_fork_cancel_cgroup;/* * If we fail beyond this point we don't free the allocated * futex hash map. We assume that another thread will be created
Quoted 9 lines · Vlastimil Babka
Quoted 6 lines · Edward Adam Davis
After
futex_hash_allocate_default()fails, the logic should jump tobad_fork_cancel_cgroup, notbad_fork_core_free.Jumping to
bad_fork_core_freewould cause a siglock imbalance.Signed-off-by Edward Adam Davis <[email protected]>Sebastian already fixed this and it's in tip: locking/urgent
A pull request has been sent to Linus earlier today.
Sebastian