Re: How does gdb write to RO virtual memory and get away with it?

On Mar 4, 8:19 pm, Joel Fernandes <agnel.j...@xxxxxxxxx> wrote:

One last question, Do you think new VMAs are created when a copy-on-
write happens? Because now memory areas that copy on write triggered
on might not be file backed but anonymous. If yes, doesn't this create
a lot of VMAs if a copy-on-writes keeps happening? Does the kernel
have some sort of a VMA merging algorithm for this?

The kernel does have a VMA merging algorithm. When a fault triggers a
copy on write, the kernel checks the previous page and the next page
to see if they have a VMA that the new page can be merged into.