Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()

2016-04-28 Thread Ingo Molnar
* Kees Cook wrote: > On Thu, Apr 28, 2016 at 9:47 AM, One Thousand Gnomes > wrote: > > O> For example, this is what I've got currently: > >> > >> /* Detect and warn about potential overlaps. */ > >> void *memcpy(void *dest, const void *src, size_t n) > >> { > >> if (dest > src && dest -

Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()

2016-04-28 Thread Kees Cook
On Thu, Apr 28, 2016 at 9:47 AM, One Thousand Gnomes wrote: > O> For example, this is what I've got currently: >> >> /* Detect and warn about potential overlaps. */ >> void *memcpy(void *dest, const void *src, size_t n) >> { >> if (dest > src && dest - src < n) >> warn("Pot

Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()

2016-04-28 Thread One Thousand Gnomes
O> For example, this is what I've got currently: > > /* Detect and warn about potential overlaps. */ > void *memcpy(void *dest, const void *src, size_t n) > { > if (dest > src && dest - src < n) > warn("Potentially unsafe overlapping memcpy detected!"); > return __m

Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()

2016-04-28 Thread Kees Cook
On Thu, Apr 28, 2016 at 2:37 AM, Ingo Molnar wrote: > > * Kees Cook wrote: > >> On Thu, Apr 28, 2016 at 2:04 AM, Ingo Molnar wrote: >> > >> > * Kees Cook wrote: >> >> +void *memcpy(void *dest, const void *src, size_t n) >> > >> > btw., if there's any doubt about other overlapping uses, we could

Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()

2016-04-28 Thread Kees Cook
On Thu, Apr 28, 2016 at 2:37 AM, Ingo Molnar wrote: > > * Kees Cook wrote: > >> On Thu, Apr 28, 2016 at 2:04 AM, Ingo Molnar wrote: >> > >> > * Kees Cook wrote: >> > > +#define memmove memmove >> > >> > Btw., what's the purpose of this define? If it's already defined then we >> >

Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()

2016-04-28 Thread Ingo Molnar
* Kees Cook wrote: > On Thu, Apr 28, 2016 at 2:04 AM, Ingo Molnar wrote: > > > > * Kees Cook 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

Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()

2016-04-28 Thread Kees Cook
On Thu, Apr 28, 2016 at 2:04 AM, Ingo Molnar wrote: > > * Kees Cook 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 memm

Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()

2016-04-28 Thread Ingo Molnar
* Kees Cook wrote: > +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? Thanks, Ingo

Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()

2016-04-28 Thread Ingo Molnar
* Kees Cook wrote: > Instead of having non-standard memcpy() behavior, explicitly call the new > function memmove(), make it available to the decompressors, and switch > the two overlap cases (screen scrolling and ELF parsing) to use memmove(). > Additionally documents the purpose of compressed/

[PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()

2016-04-26 Thread Kees Cook
Instead of having non-standard memcpy() behavior, explicitly call the new function memmove(), make it available to the decompressors, and switch the two overlap cases (screen scrolling and ELF parsing) to use memmove(). Additionally documents the purpose of compressed/string.c. Suggested-by: Lasse