]> 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)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 16 Dec 2021 03:01:35 +0000 (22:01 -0500)
commit86c3afdf9759fce76ba228dddcd9ce185b0e429b
treeefb8c861bef1c83f72e7f1713f0da7829d92977e
parent275240dcacbb4590f164cc8004eb2a7417b23d44
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>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
fs/binfmt_elf.c