[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <18c36a78-4082-fab6-c7c9-69a249516803@yandex.ru>
Date: Thu, 30 Mar 2023 20:48:46 +0500
From: stsp <stsp2@...dex.ru>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc: linux-mm@...ck.org,
Jakub Matěna <matenajakub@...il.com>,
Hugh Dickins <hughd@...gle.com>,
Vlastimil Babka <vbabka@...e.cz>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>
Subject: MREMAP_FIXED unmaps dest on error
Hello.
The attached test-case demonstrates a
bug in mremap(). If MREMAP_FIXED is used
over an existing mapping and mremap() fails,
destination area gets unmapped.
AFAIK the failed syscall should have no
observable effects.
There is also another bug demonstrated by
the same test-case. Namely, it does 2 subsequent
mprotect()s on the same page, changing the
protection and restoring it back. But VMAs
are not merged, so the subsequent mremap()
fails (and exhibits a bug by unmapping dest).
View attachment "mrtst2.c" of type "text/x-csrc" (1594 bytes)
Powered by blists - more mailing lists