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] [day] [month] [year] [list]
Message-ID: <CAMm8Nh39RLt9rWNBu7nKKF-hJsRT25kn8VzANLy4PyunugcX0A@mail.gmail.com>
Date:   Tue, 22 Aug 2023 09:41:52 -0400
From:   Kursad Oney <kursad.oney@...adcom.com>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     linux-arm-kernel@...ts.infradead.org,
        BCM Kernel Feedback <bcm-kernel-feedback-list@...adcom.com>,
        Russell King <linux@...linux.org.uk>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ARM: memset: cast the constant byte to unsigned char

Hi Linus, Ard,


On Thu, Aug 10, 2023 at 4:15 AM Linus Walleij <linus.walleij@...aro.org> wrote:
>
> On Wed, May 17, 2023 at 8:14 PM Kursad Oney <kursad.oney@...adcom.com> wrote:
>
> > memset() description in ISO/IEC 9899:1999 (and elsewhere) says:
> >
> >         The memset function copies the value of c (converted to an
> >         unsigned char) into each of the first n characters of the
> >         object pointed to by s.
> >
> > The kernel's arm32 memset does not cast c to unsigned char. This results
> > in the following code to produce erroneous output:
> >
> >         char a[128];
> >         memset(a, -128, sizeof(a));
> >
> > This is because gcc will generally emit the following code before
> > it calls memset() :
> >
> >         mov   r0, r7
> >         mvn   r1, #127        ; 0x7f
> >         bl    00000000 <memset>
> >
> > r1 ends up with 0xffffff80 before being used by memset() and the
> > 'a' array will have -128 once in every four bytes while the other
> > bytes will be set incorrectly to -1 like this (printing the first
> > 8 bytes) :
> >
> >         test_module: -128 -1 -1 -1
> >         test_module: -1 -1 -1 -128
> >
> > The change here is to 'and' r1 with 255 before it is used.
> >
> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> > Signed-off-by: Kursad Oney <kursad.oney@...adcom.com>
>
> Wow you found this old thing!
> Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
>
> Can you please put this into Russell's patch tracker?
> https://www.arm.linux.org.uk/developer/

Thank you for the reviews. I just got back from vacation and will add
this into Russell's tracker.

>
> Yours,
> Linus Walleij

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4206 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ