public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/16554] New: memset incorrect for negative signed char
@ 2014-02-11 12:06 geoff at dyalog dot com
  2014-02-11 23:23 ` [Bug libc/16554] [arm] " jsm28 at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: geoff at dyalog dot com @ 2014-02-11 12:06 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=16554

            Bug ID: 16554
           Summary: memset incorrect for negative signed char
           Product: glibc
           Version: 2.13
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: geoff at dyalog dot com
                CC: drepper.fsp at gmail dot com

memset() for the ARM does not honour the "converted to an unsigned char"
required by 7.21.6.1 of ISO/IEC 9899:1999(E)

signed char smallint = -3;
signed char smallarray[10];

memset(smallarray, smallint, 10);

results in smallarray[0] ←→ -3
           smallarray[1] ←→ -1
           smallarray[2] ←→ -1
           smallarray[3] ←→ -1
           smallarray[4] ←→ -3
...
code widens the smallint of -3 to int with sign extension - correctly. memset()
fails to AND this with 0xff before shifting and ORing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From glibc-bugs-return-21408-listarch-glibc-bugs=sources.redhat.com@sourceware.org Tue Feb 11 12:21:43 2014
Return-Path: <glibc-bugs-return-21408-listarch-glibc-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-glibc-bugs@sources.redhat.com
Received: (qmail 6680 invoked by alias); 11 Feb 2014 12:21:42 -0000
Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <glibc-bugs.sourceware.org>
List-Subscribe: <mailto:glibc-bugs-subscribe@sourceware.org>
List-Post: <mailto:glibc-bugs@sourceware.org>
List-Help: <mailto:glibc-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: glibc-bugs-owner@sourceware.org
Delivered-To: mailing list glibc-bugs@sourceware.org
Received: (qmail 6644 invoked by uid 48); 11 Feb 2014 12:21:38 -0000
From: "neleai at seznam dot cz" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/16554] [arm] memset incorrect for negative signed char
Date: Tue, 11 Feb 2014 12:21:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: glibc
X-Bugzilla-Component: libc
X-Bugzilla-Version: 2.13
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: neleai at seznam dot cz
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at sourceware dot org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc short_desc
Message-ID: <bug-16554-131-LzMdJJG0cv@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-16554-131@http.sourceware.org/bugzilla/>
References: <bug-16554-131@http.sourceware.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://sourceware.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-02/txt/msg00385.txt.bz2
Content-length: 534

https://sourceware.org/bugzilla/show_bug.cgi?id\x16554

Ondrej Bilka <neleai at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |neleai at seznam dot cz
            Summary|memset incorrect for        |[arm] memset incorrect for
                   |negative signed char        |negative signed char

--
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/16554] [arm] memset incorrect for negative signed char
  2014-02-11 12:06 [Bug libc/16554] New: memset incorrect for negative signed char geoff at dyalog dot com
@ 2014-02-11 23:23 ` jsm28 at gcc dot gnu.org
  2014-02-12 10:53 ` geoff at dyalog dot com
  2014-06-13  8:39 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2014-02-11 23:23 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16554

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
Such a bug was fixed in 2005:

commit a7ed1adbecb6aac49af75aae3b3498798cf63abc
Author: Daniel Jacobowitz <dan@codesourcery.com>
Date:   Mon Oct 10 15:00:47 2005 +0000

        * sysdeps/arm/memset.S (memset): Correct handling of negative
        arguments.

(I am doubtful of the reported version 2.13, which is a lot more recent than
that.)

If you see this with current glibc (2.19 or current git), please give a
complete compilable self-contained testcase, not code fragments, with details
of how glibc was configured.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/16554] [arm] memset incorrect for negative signed char
  2014-02-11 12:06 [Bug libc/16554] New: memset incorrect for negative signed char geoff at dyalog dot com
  2014-02-11 23:23 ` [Bug libc/16554] [arm] " jsm28 at gcc dot gnu.org
@ 2014-02-12 10:53 ` geoff at dyalog dot com
  2014-06-13  8:39 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: geoff at dyalog dot com @ 2014-02-12 10:53 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16554

--- Comment #2 from Geoff Streeter <geoff at dyalog dot com> ---
Might be blaming the wrong people here - sorry.

Using a standard Raspberian and it looks like the dodgy implementation of
memset is in a library called
libcofi_rpi.so, which gets loaded automatically because /etc/ld.so.preload
contains the line:

/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so

The source code for libcofi_rpi.so seems to come from this project, where you
can see that the implementation of memset doesn't start with anything like "and
r1,r1,#0xff":

https://github.com/bavison/arm-mem 

I will log a bug against that project.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libc/16554] [arm] memset incorrect for negative signed char
  2014-02-11 12:06 [Bug libc/16554] New: memset incorrect for negative signed char geoff at dyalog dot com
  2014-02-11 23:23 ` [Bug libc/16554] [arm] " jsm28 at gcc dot gnu.org
  2014-02-12 10:53 ` geoff at dyalog dot com
@ 2014-06-13  8:39 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13  8:39 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16554

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-13  8:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-11 12:06 [Bug libc/16554] New: memset incorrect for negative signed char geoff at dyalog dot com
2014-02-11 23:23 ` [Bug libc/16554] [arm] " jsm28 at gcc dot gnu.org
2014-02-12 10:53 ` geoff at dyalog dot com
2014-06-13  8:39 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).