[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jJeqvGq-9yBDBCEGcAfw4-=yGn2JQfMynFs2_MFj51HpQ@mail.gmail.com>
Date: Mon, 7 Mar 2016 15:30:02 -0800
From: Kees Cook <keescook@...omium.org>
To: Baoquan He <bhe@...hat.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Yinghai Lu <yinghai@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>, Vivek Goyal <vgoyal@...hat.com>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Andy Lutomirski <luto@...nel.org>, lasse.collin@...aani.org,
Andrew Morton <akpm@...ux-foundation.org>,
Dave Young <dyoung@...hat.com>
Subject: Re: [PATCH v3 12/19] x86, kaslr: Fix a bug that relocation can not be
handled when kernel is loaded above 2G
On Fri, Mar 4, 2016 at 8:25 AM, Baoquan He <bhe@...hat.com> wrote:
> When process 32 bit relocation tables a local variable 'extended'
> is defined to calculate the physical address of relocs entry.
> However its type is 'int' which is enough for i386, but not enough
> for x86_64. That's why relocation can only be handled under 2G.
> Otherwise a overflow will happen and cause system hang.
>
> Here change it to 'long' as 32 bit inverse relocation processing
> does, and this change is safe for i386 relocation handling.
>
> Signed-off-by: Baoquan He <bhe@...hat.com>
Acked-by: Kees Cook <keescook@...omium.org>
This patch should probably be moved up into the start of this series
instead of living in the middle here, since it's a clear stand-alone
bug fix.
-Kees
> ---
> arch/x86/boot/compressed/misc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
> index 4b2cd0c..70445c3 100644
> --- a/arch/x86/boot/compressed/misc.c
> +++ b/arch/x86/boot/compressed/misc.c
> @@ -298,7 +298,7 @@ static void handle_relocations(void *output, unsigned long output_len)
> * So we work backwards from the end of the decompressed image.
> */
> for (reloc = output + output_len - sizeof(*reloc); *reloc; reloc--) {
> - int extended = *reloc;
> + long extended = *reloc;
> extended += map;
>
> ptr = (unsigned long)extended;
> --
> 2.5.0
>
--
Kees Cook
Chrome OS & Brillo Security
Powered by blists - more mailing lists