lkml.org 
[lkml]   [2016]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()
From
On Thu, Apr 28, 2016 at 2:04 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Kees Cook <keescook@chromium.org> wrote:
> > +#define memmove memmove
>
> Btw., what's the purpose of this define? If it's already defined then we should
> get a build warning. If it's not, we won't.

It's for the decompressor that checks for memmove existing already via
"ifdef memmove". If this isn't done here, we will end up with two
memmove implementations.

>> +void *memcpy(void *dest, const void *src, size_t n)
>
> btw., if there's any doubt about other overlapping uses, we could add this to
> memcpy():
>
> WARN_ON_ONCE(dest > src && dest-src < n);
>
> or so? Does printk() work so early on?

It does not, but we could use either "error" or the new "warn". Should
we abort a boot in this case, or just warn about it? (Our
implementations of memcpy, fwiw, currently seem to support overlap, so
I would suggest warn.)

-Kees

--
Kees Cook
Chrome OS & Brillo Security

\
 
 \ /
  Last update: 2016-04-28 11:41    [W:0.559 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site