lkml.org 
[lkml]   [2019]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/boot/64: Fix crash if kernel images crosses page table boundary
On Tue, 25 Jun 2019, Kirill A. Shutemov wrote:
> On Tue, Jun 25, 2019 at 09:04:39PM +0200, Thomas Gleixner wrote:
>
> > > + pmd[idx % PTRS_PER_PMD] = pmd_entry + i * PMD_SIZE;
> >
> > This part is functionally equivivalent. So what's the value of this change?
>
> Precedence of operators were broken
>
> idx = i + (physaddr >> PMD_SHIFT) % PTRS_PER_PMD;
>
> reads by compiler as
>
> idx = i + ((physaddr >> PMD_SHIFT) % PTRS_PER_PMD);
>
> not as
>
> idx = (i + (physaddr >> PMD_SHIFT)) % PTRS_PER_PMD;
>
> Therefore 'idx' can become >= PTRS_PER_PMD.

Indeed. Please mention it in the change log. I did not spot it right away.

Thanks,

tglx


\
 
 \ /
  Last update: 2019-06-25 21:57    [W:0.046 / U:1.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site