[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jKG4OszKkprY2fNvxZBHXxFaP8Kqr_7j389ho6mkkyyWA@mail.gmail.com>
Date: Fri, 22 Apr 2016 15:01:46 -0700
From: Kees Cook <keescook@...omium.org>
To: Lasse Collin <lasse.collin@...aani.org>
Cc: Andrey Ryabinin <aryabinin@...tuozzo.com>,
Peter Zijlstra <peterz@...radead.org>,
Denys Vlasenko <dvlasenk@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"H. Peter Anvin" <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
Yinghai Lu <yinghai@...nel.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Borislav Petkov <bp@...e.de>,
Dmitry Vyukov <dvyukov@...gle.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>, Baoquan He <bhe@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
Brian Gerst <brgerst@...il.com>,
Andy Lutomirski <luto@...capital.net>,
"H.J. Lu" <hjl.tools@...il.com>
Subject: Re: [tip:x86/boot] x86/boot: Make memcpy() handle overlaps
On Fri, Apr 22, 2016 at 2:05 PM, Lasse Collin <lasse.collin@...aani.org> wrote:
> On 2016-04-22 tip-bot for Kees Cook wrote:
>> x86/boot: Make memcpy() handle overlaps
>>
>> Two uses of memcpy() (screen scrolling and ELF parsing) were handling
>> overlapping memory areas. While there were no explicitly noticed bugs
>> here (yet), it is best to fix this so that the copying will always be
>> safe.
>>
>> Instead of making a new memmove() function that might collide with
>> other memmove() definitions in the decompressors, this just makes the
>> compressed boot code's copy of memcpy() overlap-safe.
>
> So far lib/decompress_unxz.c is the only decompressor that needs
> memmove(). There the local definition is inside #ifndef to make it easy
> to omit it and to use another memmove() implementation. It's enough to
> do this:
>
> #define memmove memmove
>
> To me it sounds less confusing if a function that works on overlapping
> buffers is named memmove() instead of memcpy(). In those places where
> buffers can overlap one would then use memmove() so that it's clear to
> the reader that overlapping is possible.
Okay, I'll refactor this and double-check the xz case.
Thanks!
-Kees
--
Kees Cook
Chrome OS & Brillo Security
Powered by blists - more mailing lists