futex: Initialize mm_struct::futex_ref on mm_init()
PATCH 1/1 futex: Initialize mm_struct::futex_ref on mm_init()
mm_struct::futex_ref needs to be set to NULL during mm_init() to ensure that it is not copied during fork(). Reusing the previous pointer can lead to use-after-free which can trigger
| WARNING: kernel/futex/core.c:1604 at futex_ref_rcu+0xe1/0xf0, CPU#2: swapper/2/0
Initialize mm_struct::futex_ref on mm_init().
--- kernel/futex/core.c | 1 + 1 file changed, 1 insertion(+)
kernel/futex/core.c +1 -0
@@ -1722,6 +1722,7 @@ int futex_mm_init(struct mm_struct *mm)RCU_INIT_POINTER (mm->futex_phash,NULL ); mm->futex_phash_new =NULL ;/* futex-ref */ + mm->futex_ref =NULL ;atomic_long_set (&mm->futex_atomic,0 ); mm->futex_batches =get_state_synchronize_rcu ();return 0 ;
Signature · 1 line
2.51.0
Quoted 9 lines · Sebastian Andrzej Siewior
mm_struct::futex_refneeds to be set to NULL duringmm_init()to ensure that it is not copied duringfork(). Reusing the previous pointer can lead to use-after-free which can trigger| WARNING:
kernel/futex/core.c:1604atfutex_ref_rcu+0xe1/0xf0, CPU#2: swapper/2/0Initialize
mm_struct::futex_refonmm_init().Fixes 1b708b38414d3 ("futex: Move futex_hash_free() back to __mmput()")
So this one is queued in locking/urgent and I guess I can fold this new one into it so that that commit is whole and fixed.
And then leave it in that branch for one more week for some more testing...
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 1 line · Borislav Petkov
And then leave it in that branch for one more week for some more testing...
Ok, boots on one of my machines, fix folded in and force-pushed.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 4 lines · Borislav Petkov
Quoted 1 line · Borislav Petkov
And then leave it in that branch for one more week for some more testing...
Ok, boots on one of my machines, fix folded in and force-pushed.
Thank you.
Quoted 1 line
Thx.
Sebastian