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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1583527548.8911.23.camel@mtksdccf07>
Date:   Sat, 7 Mar 2020 04:45:48 +0800
From:   Walter Wu <walter-zh.wu@...iatek.com>
To:     Stephen Rothwell <sfr@...b.auug.org.au>,
        Dmitry Vyukov <dvyukov@...gle.com>
CC:     Andrew Morton <akpm@...ux-foundation.org>,
        Linux Next Mailing List <linux-next@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Andrey Ryabinin <aryabinin@...tuozzo.com>
Subject: Re: linux-next: build warning after merge of the akpm-current tree

On Sat, 2020-03-07 at 02:59 +0800, Walter Wu wrote:
> On Thu, 2020-03-05 at 20:33 +1100, Stephen Rothwell wrote:
> > Hi Walter,
> > 
> > On Thu, 5 Mar 2020 16:54:36 +0800 Walter Wu <walter-zh.wu@...iatek.com> wrote:
> > >
> > > I'm sorry for the build warning, it doesn't generate in our local
> > > environment(arm64/x86_64). Would you tell me what toolchains can
> > > reproduce it?
> > 
> > I am using a PowerPC LE hosted x86_64 gcc v9.2.1 (Debian cross compiler).
> > 
> > $ /usr/bin/x86_64-linux-gnu-gcc --version
> > x86_64-linux-gnu-gcc (Debian 9.2.1-21) 9.2.1 20191130
> > 
> Hi Stephen,
> 
> Thanks for your information, It doesn't generate warning message in
> gcc-8.3.0(Debian 8.3.0-6) after apply below patch.
> 
> 
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@ -286,17 +286,19 @@ static noinline void __init
> kmalloc_oob_in_memset(void)
>  static noinline void __init kmalloc_memmove_invalid_size(void)
>  {
>         char *ptr;
> -       size_t size = 64;
> +       size_t size1 = 64;
> +       size_t size2 = 62;
> 
>         pr_info("invalid size in memmove\n");
> -       ptr = kmalloc(size, GFP_KERNEL);
> +       ptr = kmalloc(size1, GFP_KERNEL);
>         if (!ptr) {
>                 pr_err("Allocation failed\n");
>                 return;
>         }
> 
> -       memset((char *)ptr, 0, 64);
> -       memmove((char *)ptr, (char *)ptr + 4, -2);
> +       memset((char *)ptr, 0, size1);
> +       /* the size of memmove() is negative numbers */
> +       memmove((char *)ptr, (char *)ptr + 4, size2 - size1);
>         kfree(ptr);
>  }
> 
Hi Stephen,

Please ignore previous mail, I miss the message. Below the patch will
fix the warning.


--- a/lib/test_kasan.c
+++ b/lib/test_kasan.c
@@ -286,17 +286,19 @@ static noinline void __init
kmalloc_oob_in_memset(void)
 static noinline void __init kmalloc_memmove_invalid_size(void)
 {
        char *ptr;
-       size_t size = 64;
+       size_t size1 = 64;
+       volatile size_t size2 = -2;

        pr_info("invalid size in memmove\n");
-       ptr = kmalloc(size, GFP_KERNEL);
+       ptr = kmalloc(size1, GFP_KERNEL);
        if (!ptr) {
                pr_err("Allocation failed\n");
                return;
        }

-       memset((char *)ptr, 0, 64);
-       memmove((char *)ptr, (char *)ptr + 4, -2);
+       memset((char *)ptr, 0, size1);
+       /* the size of memmove() is negative number */
+       memmove((char *)ptr, (char *)ptr + 4, size2);
        kfree(ptr);
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ