]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: mte: Avoid the racy walk of the vma list during core dump
authorCatalin Marinas <catalin.marinas@arm.com>
Thu, 22 Dec 2022 18:12:51 +0000 (18:12 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:11 +0000 (11:58 +0100)
commitf0dd07cb154cc3adcc0cf8f44e86540b41c2bbc5
tree6be2a8126cb8dada0a9641af2270dbcde6e6a83d
parent86ba576d17dfa51924fe8beb71914980f9438456
arm64: mte: Avoid the racy walk of the vma list during core dump

commit 4f4c549feb4ecca95ae9abb88887b941d196f83a upstream.

The MTE coredump code in arch/arm64/kernel/elfcore.c iterates over the
vma list without the mmap_lock held. This can race with another process
or userfaultfd concurrently modifying the vma list. Change the
for_each_mte_vma macro and its callers to instead use the vma snapshot
taken by dump_vma_snapshot() and stored in the cprm object.

Fixes: 8e6b6d9b1ce6 ("arm64: mte: Dump the MTE tags in the core file")
Cc: <stable@vger.kernel.org> # 5.18.x
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Seth Jenkins <sethjenkins@google.com>
Suggested-by: Seth Jenkins <sethjenkins@google.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20221222181251.1345752-4-catalin.marinas@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kernel/elfcore.c