]> 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>
Tue, 8 Mar 2022 18:19:09 +0000 (13:19 -0500)
commit9c47c152779fa7ad82762fd464649a5772aa456e
treeb886399c628872c574cde30e8470ea96cb93c9ad
parent851064ff21c51f245a12423a999a6cfb61cb436e
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