[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1906252204590.32342@nanos.tec.linutronix.de>
Date: Tue, 25 Jun 2019 22:05:22 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: "Kirill A. Shutemov" <kirill@...temov.name>
cc: Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, x86@...nel.org,
linux-kernel@...r.kernel.org,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: [PATCH] x86/boot/64: Fix crash if kernel images crosses page
table boundary
On Tue, 25 Jun 2019, Thomas Gleixner wrote:
> 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.
I fixed it up already. No need to resend.
Thanks,
tglx
Powered by blists - more mailing lists