Re: What will happen if 2 processes map same physical page

2019-03-22 Thread Valdis Klētnieks
On Fri, 22 Mar 2019 12:15:49 +0300, Lev Olshvang said: > But the question might be rephrased : IMHO Kernel should mandate same PTE > flags no matter how many virtual mapping were made to the same physical page. And exactly *why* should it be "mandated"? Certainly, for many classes of objects,

Re: What will happen if 2 processes map same physical page

2019-03-22 Thread Okash Khawaja
Hi Lev, On Fri, 22 Mar 2019 12:15:49 +0300 Lev Olshvang wrote: > Hello Okash, > > Actually there were 3 question: > > Third question is : > Is there any way to tell the kernel that PTE of same physical page > should be equal in all processes? Not that I am aware of. You mention SELinux

Re: What will happen if 2 processes map same physical page

2019-03-22 Thread Lev Olshvang
Hello Okash, Actually there were 3 question: Third question is : Is there any way to tell the kernel that PTE of same physical page should be equal in all processes? For example, shared lib mapped from different processes to same physical page must have same PTE, isn it? And the presence of

Re: What will happen if 2 processes map same physical page

2019-03-21 Thread Okash Khawaja
On Thu, 21 Mar 2019 12:56:17 +0300 Lev Olshvang wrote: > Hi Vaaldis, > > Thanks for answer, > I still wondering whether the kernel will allow write to a read-only > page of shared library while it has mapped to several processes? > Kernel knows that page's reference count >1, will it allow >

Re: What will happen if 2 processes map same physical page

2019-03-21 Thread Lev Olshvang
Hi Vaaldis, Thanks for answer, I still wondering whether the kernel will allow write to a read-only page of shared library while it has mapped to several processes? Kernel knows that page's reference count >1, will it allow mmap/mprotect to change page protection ? Or will it allow direct

Re: What will happen if 2 processes map same physical page

2019-03-20 Thread Valdis Klētnieks
On Wed, 20 Mar 2019 16:42:39 +0300, Lev Olshvang said: > The question is it ipossiblle in Linux/MMU/TLB that 2 processes map to > the same physical address? Totally possible. That's how mmap shared memory works, and why shared libraries are possible. > Will CPU or TLB discover that second