]> 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, 31 Jan 2022 16:09:33 +0000 (11:09 -0500)
commit3d322b596e26d05f8b600a06e4d461306ead8b86
treee257c62fca131c72b9727ecdbeb029da2e26b950
parent26291c54e111ff6ba87a164d85d4a4e134b7315c
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