]> Git Repo - J-linux.git/commitdiff
ARM: 9431/1: mm: Pair atomic_set_release() with _read_acquire()
authorLinus Walleij <[email protected]>
Wed, 23 Oct 2024 12:05:34 +0000 (13:05 +0100)
committerRussell King (Oracle) <[email protected]>
Wed, 13 Nov 2024 08:15:23 +0000 (08:15 +0000)
The code for syncing vmalloc memory PGD pointers is using
atomic_read() in pair with atomic_set_release() but the
proper pairing is atomic_read_acquire() paired with
atomic_set_release().

This is done to clearly instruct the compiler to not
reorder the memcpy() or similar calls inside the section
so that we do not observe changes to init_mm. memcpy()
calls should be identified by the compiler as having
unpredictable side effects, but let's try to be on the
safe side.

Cc: [email protected]
Fixes: d31e23aff011 ("ARM: mm: make vmalloc_seq handling SMP safe")
Suggested-by: Mark Rutland <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: Russell King (Oracle) <[email protected]>
arch/arm/mm/ioremap.c

index ff555823cceb86e105fcb25db510d93ecf2cf41e..89f1c97f3079c11efbfd0112fe02f833ff1df9e3 100644 (file)
@@ -141,7 +141,7 @@ void __check_vmalloc_seq(struct mm_struct *mm)
        int seq;
 
        do {
-               seq = atomic_read(&init_mm.context.vmalloc_seq);
+               seq = atomic_read_acquire(&init_mm.context.vmalloc_seq);
                memcpy_pgd(mm, VMALLOC_START, VMALLOC_END);
                if (IS_ENABLED(CONFIG_KASAN_VMALLOC)) {
                        unsigned long start =
This page took 0.048345 seconds and 4 git commands to generate.