lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YZZ4upqWGMOY+r56@hirez.programming.kicks-ass.net>
Date:   Thu, 18 Nov 2021 17:00:58 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Eric Dumazet <edumazet@...gle.com>
Cc:     kernel test robot <lkp@...el.com>, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, x86@...nel.org,
        Alexander Duyck <alexanderduyck@...com>,
        linux-um@...ts.infradead.org
Subject: Re: [tip:x86/core 1/1] arch/x86/um/../lib/csum-partial_64.c:98:12:
 error: implicit declaration of function 'load_unaligned_zeropad'


On Wed, Nov 17, 2021 at 11:40:35AM -0800, Eric Dumazet wrote:
> On Wed, Nov 17, 2021 at 10:55 AM Eric Dumazet <edumazet@...gle.com> wrote:
> >
> > On Wed, Nov 17, 2021 at 10:46 AM kernel test robot <lkp@...el.com> wrote:
> > >
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
> > > head:   d31c3c683ee668ba5d87c0730610442fd672525f
> > > commit: d31c3c683ee668ba5d87c0730610442fd672525f [1/1] x86/csum: Rewrite/optimize csum_partial()
> > > config: um-x86_64_defconfig (attached as .config)
> > > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > > reproduce (this is a W=1 build):
> > >         # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=d31c3c683ee668ba5d87c0730610442fd672525f
> > >         git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
> > >         git fetch --no-tags tip x86/core
> > >         git checkout d31c3c683ee668ba5d87c0730610442fd672525f
> > >         # save the attached .config to linux build tree
> > >         make W=1 ARCH=um SUBARCH=x86_64
> > >
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot <lkp@...el.com>
> > >
> > > All errors (new ones prefixed by >>):
> > >
> > >    arch/x86/um/../lib/csum-partial_64.c: In function 'csum_partial':
> > > >> arch/x86/um/../lib/csum-partial_64.c:98:12: error: implicit declaration of function 'load_unaligned_zeropad' [-Werror=implicit-function-declaration]
> > >       98 |   trail = (load_unaligned_zeropad(buff) << shift) >> shift;
> > >          |            ^~~~~~~~~~~~~~~~~~~~~~
> > >    cc1: some warnings being treated as errors
> > >
> > >
> >
> > Hmmm... it seems we need to guard this with CONFIG_DCACHE_WORD_ACCESS ?
> 
> Perhaps something like the following ?

Dear um folks, is this indeed the best solution? It's a bit sad to have
to add this to x86_64, but if that's the way it is...

> 
> diff --git a/arch/x86/lib/csum-partial_64.c b/arch/x86/lib/csum-partial_64.c
> index 5ec35626945b6db2f7f41c6d46d5e422810eac46..d419b9345d6dba2e924887671bc6f11c3e17ebd7
> 100644
> --- a/arch/x86/lib/csum-partial_64.c
> +++ b/arch/x86/lib/csum-partial_64.c
> @@ -91,12 +91,23 @@ __wsum csum_partial(const void *buff, int len, __wsum sum)
>                         : "memory");
>                 buff += 8;
>         }
> -       if (len & 7) {
> -               unsigned int shift = (8 - (len & 7)) * 8;
> +       len &= 7;
> +       if (len) {
>                 unsigned long trail;
> +#ifndef CONFIG_DCACHE_WORD_ACCESS
> +               union {
> +                       unsigned long   ulval;
> +                       u8              bytes[sizeof(long)];
> +               } v;
> 
> -               trail = (load_unaligned_zeropad(buff) << shift) >> shift;
> +               v.ulval = 0;
> +               memcpy(v.bytes, buff, len);
> +               trail = v.ulval;
> +#else
> +               unsigned int shift = (sizeof(long) - len) * BITS_PER_BYTE;
> 
> +               trail = (load_unaligned_zeropad(buff) << shift) >> shift;
> +#endif
>                 asm("addq %[trail],%[res]\n\t"
>                     "adcq $0,%[res]"
>                         : [res] "+r" (temp64)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ