* [PATCH Next] copy_process(): Fixed jump logic error
@ 2025-09-24 12:06 Edward Adam Davis
2025-09-24 12:29 ` David Hildenbrand
2025-09-26 15:11 ` Vlastimil Babka
0 siblings, 2 replies; 4+ messages in thread
From: Edward Adam Davis @ 2025-09-24 12:06 UTC (permalink / raw)
To: kees
Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, vschneid, akpm, david,
lorenzo.stoakes, Liam.Howlett, vbabka, rppt, surenb, mhocko,
linux-mm, linux-kernel
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.
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
kernel/fork.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/fork.c b/kernel/fork.c
index e9a7fb5c3e49..a0b8eeeb1d27 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH Next] copy_process(): Fixed jump logic error
2025-09-24 12:06 [PATCH Next] copy_process(): Fixed jump logic error Edward Adam Davis
@ 2025-09-24 12:29 ` David Hildenbrand
2025-09-26 15:11 ` Vlastimil Babka
1 sibling, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2025-09-24 12:29 UTC (permalink / raw)
To: Edward Adam Davis, kees
Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, vschneid, akpm, lorenzo.stoakes,
Liam.Howlett, vbabka, rppt, surenb, mhocko, linux-mm,
linux-kernel
On 24.09.25 14:06, Edward Adam Davis wrote:
> 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.
>
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
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?)
> ---
> kernel/fork.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/fork.c b/kernel/fork.c
> index e9a7fb5c3e49..a0b8eeeb1d27 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -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.
--
Cheers
David / dhildenb
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH Next] copy_process(): Fixed jump logic error
2025-09-24 12:06 [PATCH Next] copy_process(): Fixed jump logic error Edward Adam Davis
2025-09-24 12:29 ` David Hildenbrand
@ 2025-09-26 15:11 ` Vlastimil Babka
2025-09-26 15:21 ` Sebastian Andrzej Siewior
1 sibling, 1 reply; 4+ messages in thread
From: Vlastimil Babka @ 2025-09-26 15:11 UTC (permalink / raw)
To: Edward Adam Davis, kees, Sebastian Andrzej Siewior, akpm
Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, vschneid, david, lorenzo.stoakes,
Liam.Howlett, rppt, surenb, mhocko, linux-mm, linux-kernel
On 9/24/25 14:06, Edward Adam Davis wrote:
> 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.
>
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Sebastian already fixed this and it's in tip: locking/urgent
https://lore.kernel.org/all/20250918130945.-7SIRk8Z@linutronix.de/
> ---
> kernel/fork.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/fork.c b/kernel/fork.c
> index e9a7fb5c3e49..a0b8eeeb1d27 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH Next] copy_process(): Fixed jump logic error
2025-09-26 15:11 ` Vlastimil Babka
@ 2025-09-26 15:21 ` Sebastian Andrzej Siewior
0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-09-26 15:21 UTC (permalink / raw)
To: Vlastimil Babka
Cc: Edward Adam Davis, kees, akpm, mingo, peterz, juri.lelli,
vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman,
vschneid, david, lorenzo.stoakes, Liam.Howlett, rppt, surenb,
mhocko, linux-mm, linux-kernel
On 2025-09-26 17:11:12 [+0200], Vlastimil Babka wrote:
> On 9/24/25 14:06, Edward Adam Davis wrote:
> > 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.
> >
> > Signed-off-by: Edward Adam Davis <eadavis@qq.com>
>
> Sebastian already fixed this and it's in tip: locking/urgent
A pull request has been sent to Linus earlier today.
Sebastian
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-26 15:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-24 12:06 [PATCH Next] copy_process(): Fixed jump logic error Edward Adam Davis
2025-09-24 12:29 ` David Hildenbrand
2025-09-26 15:11 ` Vlastimil Babka
2025-09-26 15:21 ` Sebastian Andrzej Siewior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox