]> 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>
Tue, 26 Oct 2021 21:20:15 +0000 (17:20 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 30 Oct 2021 03:38:44 +0000 (23:38 -0400)
commitd45730d47a781cf4f159406108cfc7fee93647b6
tree72bc36873dfad88572831bcd2db4e02ceb9ea065
parent05bbb0e4fa9100b99ec7c36ecd8490d3c871c850
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>
fs/binfmt_elf.c