Messages in this thread |  | | From | "Yang, Bin" <> | Subject | Re: [PATCH v3 1/5] x86/mm: avoid redundant checking if pgprot has no change | Date | Tue, 4 Sep 2018 09:22:19 +0000 |
| |
On Tue, 2018-09-04 at 17:11 +0800, Bin Yang wrote: > On Tue, 2018-09-04 at 09:49 +0200, Thomas Gleixner wrote: > > On Tue, 4 Sep 2018, Yang, Bin wrote: > > > On Mon, 2018-09-03 at 23:57 +0200, Thomas Gleixner wrote: > > > > > > > > The last patch which does the overlap check is equally broken: > > > > > > Sorry that I did not understand the broken of last patch. > > > > I meant 4/5 sorry. That's the one which introduces the overlap check and > > does this: > > > > > > + /* > > > > + * Ensure that the requested pgprot does not violate static protection > > > > + * requirements. > > > > + */ > > > > + new_prot = static_protections(req_prot, address, > > > > + numpages << PAGE_SHIFT, pfn); > > > > > > > > It expands new_prot to the whole range even if the protections only > > > > overlap. That should not happen in practice, but we have no checks for that > > > > at all. > > > > > > Below code in patch #3 should cover this check. It will double check > > > new_prot in whole large page range. > > > > Which is exactly what is wrong. Read again what I wrote.
It looks this new_prot might have less protection bits and always passes the following check at the begin numpages. I think it can be changed as below:
new_prot = static_protections(req_prot, address, 1, pfn);
By the way, I just sent a empty mail to you. I am so sorry for it.
> > > > Thanks, > > > > tglx
|  |