Re: MAP_FIXED leaving holes on failure is very difficult to recover from and can even be a security hole

From: Lorenzo Stoakes (ARM)

Date: Thu Nov 05 2026 - 11:26:35 EST


[ please check kernel mails in MAINTAINERS - my and Liam's at least were
incorrect, which makes it easy to miss. Fixed those up. ]

Thanks for the report.

In general linux system calls do not guarantee compound operation
atomicity, and any assumption based on that is incorrect. If you see an
error - the operation failed, perhaps partially.

Further, a failed MAP_FIXED leaving gaps was the case for most of the
history of linux. Avoiding that is infeasible.

I advise you to review the NOTES section
https://man7.org/linux/man-pages/man2/mmap.2.html on MAP_FIXED - your
suggested use of it is not recommended.

--
Cheers, Lorenzo