From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753635AbcD1Jhu (ORCPT ); Thu, 28 Apr 2016 05:37:50 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34846 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753247AbcD1Jhq (ORCPT ); Thu, 28 Apr 2016 05:37:46 -0400 Date: Thu, 28 Apr 2016 11:37:41 +0200 From: Ingo Molnar To: Kees Cook Cc: Yinghai Lu , Baoquan He , Borislav Petkov , Ingo Molnar , "x86@kernel.org" , Andrew Morton , Andrey Ryabinin , Dmitry Vyukov , "H.J. Lu" , Josh Poimboeuf , Andy Lutomirski , LKML Subject: Re: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove() Message-ID: <20160428093741.GA23251@gmail.com> References: <20160426214606.GA5758@www.outflux.net> <20160428090427.GB5773@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * 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 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. So: triton:~/tip> git grep memmove | grep -i ifdef triton:~/tip> what am I missing? > >> +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.) Yeah, I'd definitely not try to crash the bootup for the user, but try to continue. Thanks, Ingo