Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1389924

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

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()
Date 2016-04-28 11:20 +0200
Message-ID <rsQh3-Jd-5@gated-at.bofh.it> (permalink)
References <rsj1L-6xe-13@gated-at.bofh.it> <rsQ7p-Ft-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] x86/boot: Rename overlapping memcpy() to memmove() Kees Cook <keescook@chromium.org> - 2016-04-26 23:50 +0200
  Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove() Ingo Molnar <mingo@kernel.org> - 2016-04-28 11:10 +0200
  Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove() Ingo Molnar <mingo@kernel.org> - 2016-04-28 11:10 +0200
    Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove() Kees Cook <keescook@chromium.org> - 2016-04-28 11:20 +0200
      Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove() Ingo Molnar <mingo@kernel.org> - 2016-04-28 11:40 +0200
        Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove() Kees Cook <keescook@chromium.org> - 2016-04-28 18:10 +0200
        Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove() Kees Cook <keescook@chromium.org> - 2016-04-28 18:40 +0200
          Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove() One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-04-28 18:50 +0200
            Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove() Kees Cook <keescook@chromium.org> - 2016-04-28 18:50 +0200
              Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove() Ingo Molnar <mingo@kernel.org> - 2016-04-28 19:50 +0200
  [tip:x86/boot] x86/boot: Rename overlapping memcpy() to memmove() tip-bot for Kees Cook <tipbot@zytor.com> - 2016-04-28 12:40 +0200

csiph-web