]> www.infradead.org Git - users/jedix/linux-maple.git/commit
binfmt_elf: Take the mmap lock when walking the VMA list
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 31 Jan 2022 15:37:40 +0000 (15:37 +0000)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 14 Feb 2022 15:21:53 +0000 (10:21 -0500)
commitbe1bf2fe66fb1d5c01911ae270e297ca07e2737a
tree2209832854d69bf19998ad494fd3976aa498a51e
parent754e0b0e35608ed5206d6a67a791563c631cec07
binfmt_elf: Take the mmap lock when walking the VMA list

I'm not sure if the VMA list can change under us, but dump_vma_snapshot()
is very careful to take the mmap_lock in write mode.  We only need to
take it in read mode here as we do not care if the size of the stack
VMA changes underneath us.

If it can be changed underneath us, this is a potential use-after-free
for a multithreaded process which is dumping core.

Fixes: 2aa362c49c31 ("coredump: extend core dump note section to contain file names of mapped files")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
fs/binfmt_elf.c