public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i
@ 2012-08-13  1:00 psyberbits at gmail dot com
  2012-08-13  2:57 ` [Bug libc/14461] " john at pointysoftware dot net
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: psyberbits at gmail dot com @ 2012-08-13  1:00 UTC (permalink / raw)
  To: glibc-bugs

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

             Bug #: 14461
           Summary: __m128i_strloadu_tolower returns unaligned __m128i
           Product: glibc
           Version: 2.17
            Status: NEW
          Severity: critical
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: psyberbits@gmail.com
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


Created attachment 6575
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6575
patch

__m128i_strloadu_tolower function in
sysdeps/x86_64/multiarch/strcasestr-nonascii.c does not use _mm_loadu_si128()
to return the variable. So, if the caller has unaligned stack the program will
crash.

We had crashes with openssl and glibc when we use Wine and the solution was to
use _mm_loadu_si128().

Here are the bug reports:
https://bugs.archlinux.org/task/23277
https://bugs.archlinux.org/task/31020

I attached the patch.

Thanks.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
@ 2012-08-13  2:57 ` john at pointysoftware dot net
  2012-08-13  3:37 ` psyberbits at gmail dot com
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: john at pointysoftware dot net @ 2012-08-13  2:57 UTC (permalink / raw)
  To: glibc-bugs

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

John Schoenick [:johns] <john at pointysoftware dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john at pointysoftware dot
                   |                            |net

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
  2012-08-13  2:57 ` [Bug libc/14461] " john at pointysoftware dot net
@ 2012-08-13  3:37 ` psyberbits at gmail dot com
  2012-08-13  3:49 ` sh at lutzhaase dot com
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: psyberbits at gmail dot com @ 2012-08-13  3:37 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from oblique <psyberbits at gmail dot com> 2012-08-13 03:37:10 UTC ---
Created attachment 6576
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6576
patch v2

I decided to run Coccinelle to see if the same bug exists in other places and I
found it in one more function which is a testcase.

I attached a 2nd version of the patch.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
  2012-08-13  2:57 ` [Bug libc/14461] " john at pointysoftware dot net
  2012-08-13  3:37 ` psyberbits at gmail dot com
@ 2012-08-13  3:49 ` sh at lutzhaase dot com
  2012-08-13 18:11 ` psyberbits at gmail dot com
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: sh at lutzhaase dot com @ 2012-08-13  3:49 UTC (permalink / raw)
  To: glibc-bugs

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

Sven-Hendrik Haase <sh at lutzhaase dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sh at lutzhaase dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (2 preceding siblings ...)
  2012-08-13  3:49 ` sh at lutzhaase dot com
@ 2012-08-13 18:11 ` psyberbits at gmail dot com
  2012-08-13 18:52 ` psyberbits at gmail dot com
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: psyberbits at gmail dot com @ 2012-08-13 18:11 UTC (permalink / raw)
  To: glibc-bugs

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

oblique <psyberbits at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware    |drepper.fsp at gmail dot
                   |dot org                     |com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (3 preceding siblings ...)
  2012-08-13 18:11 ` psyberbits at gmail dot com
@ 2012-08-13 18:52 ` psyberbits at gmail dot com
  2012-08-13 18:56 ` aj at suse dot de
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: psyberbits at gmail dot com @ 2012-08-13 18:52 UTC (permalink / raw)
  To: glibc-bugs

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

oblique <psyberbits at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|drepper.fsp at gmail dot    |unassigned at sourceware
                   |com                         |dot org

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (4 preceding siblings ...)
  2012-08-13 18:52 ` psyberbits at gmail dot com
@ 2012-08-13 18:56 ` aj at suse dot de
  2012-08-13 19:08 ` psyberbits at gmail dot com
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: aj at suse dot de @ 2012-08-13 18:56 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 from Andreas Jaeger <aj at suse dot de> 2012-08-13 18:56:34 UTC ---
The function returns an object of type __m128i - which is be properly aligned
if the stack is properly aligned.

Looking at the arch reports, this looks related to this gcc bug:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838

The question is should glibc work around those problems and be on the safe side
- or does this need fixing in other libraries and programs?

I'm adding HJ and Jakub for discusion since both have been involved in the GCC
bug.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (5 preceding siblings ...)
  2012-08-13 18:56 ` aj at suse dot de
@ 2012-08-13 19:08 ` psyberbits at gmail dot com
  2012-08-13 20:20 ` aj at suse dot de
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: psyberbits at gmail dot com @ 2012-08-13 19:08 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 from oblique <psyberbits at gmail dot com> 2012-08-13 19:08:03 UTC ---
Any other functions that they return an object of type __m128i they use
_mm_loadu_si128 function. e.g. the functions that are in
sysdeps/x86_64/multiarch/strstr.c

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (6 preceding siblings ...)
  2012-08-13 19:08 ` psyberbits at gmail dot com
@ 2012-08-13 20:20 ` aj at suse dot de
  2012-08-13 21:36 ` psyberbits at gmail dot com
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: aj at suse dot de @ 2012-08-13 20:20 UTC (permalink / raw)
  To: glibc-bugs

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

Andreas Jaeger <aj at suse dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aj at suse dot de

--- Comment #4 from Andreas Jaeger <aj at suse dot de> 2012-08-13 20:20:10 UTC ---
grep shows:
sysdeps/x86_64/multiarch/strcspn-c.c:          mask = _mm_loadu_si128 ((__m128i
*) a);
sysdeps/x86_64/multiarch/varshift.h:               _mm_loadu_si128 ((__m128i *)
(___m128i_shift_right
sysdeps/x86_64/multiarch/strspn-c.c:          mask = _mm_loadu_si128 ((__m128i
*) a);
sysdeps/x86_64/multiarch/strstr.c:  return _mm_loadu_si128 ((__m128i *) p);

And looking at the files, it's (except varshift.h) the input parameter that is
returned. In these cases the loadu is always needed.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (7 preceding siblings ...)
  2012-08-13 20:20 ` aj at suse dot de
@ 2012-08-13 21:36 ` psyberbits at gmail dot com
  2012-08-14  6:28 ` jakub at redhat dot com
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: psyberbits at gmail dot com @ 2012-08-13 21:36 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #5 from oblique <psyberbits at gmail dot com> 2012-08-13 21:35:56 UTC ---
Indeed..
I also tried __attribute__((__aligned__(16))) and still crashes. Only with
_mm_loadu_si128 it did not.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (8 preceding siblings ...)
  2012-08-13 21:36 ` psyberbits at gmail dot com
@ 2012-08-14  6:28 ` jakub at redhat dot com
  2012-08-14 15:06 ` carlos_odonell at mentor dot com
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jakub at redhat dot com @ 2012-08-14  6:28 UTC (permalink / raw)
  To: glibc-bugs

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

Jakub Jelinek <jakub at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at redhat dot com

--- Comment #6 from Jakub Jelinek <jakub at redhat dot com> 2012-08-14 06:28:02 UTC ---
Whatever function in the backtrace misaligned the stack should be fixed.  So,
if it is openssl, the fix needs to be done there, if it is some glibc routine,
you need to state which one.  If you use -mpreferred-stack-boundary=2 or
similar on some code, you can do that only if you don't call any code built
without that option from such code.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (9 preceding siblings ...)
  2012-08-14  6:28 ` jakub at redhat dot com
@ 2012-08-14 15:06 ` carlos_odonell at mentor dot com
  2012-08-14 15:16 ` psyberbits at gmail dot com
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: carlos_odonell at mentor dot com @ 2012-08-14 15:06 UTC (permalink / raw)
  To: glibc-bugs

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

Carlos O'Donell <carlos_odonell at mentor dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |carlos_odonell at mentor
                   |                            |dot com

--- Comment #7 from Carlos O'Donell <carlos_odonell at mentor dot com> 2012-08-14 15:05:45 UTC ---
Waiting for submitter to provide the name of the glibc function which misaligns
the stack.

I agree with Jakub, making each function robust in the face of a misaligned
stack is not correct. The program must conform the ABI and keep the stack
aligned as required at function call time.

If there are no glibc functions which misalign the stack then this issue should
be closed as RESOLVED WONTFIX.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (10 preceding siblings ...)
  2012-08-14 15:06 ` carlos_odonell at mentor dot com
@ 2012-08-14 15:16 ` psyberbits at gmail dot com
  2012-08-14 15:24 ` carlos_odonell at mentor dot com
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: psyberbits at gmail dot com @ 2012-08-14 15:16 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #8 from oblique <psyberbits at gmail dot com> 2012-08-14 15:16:39 UTC ---
I did some deeper debugging and it's not glibc's fault. You can close it if you
want.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (11 preceding siblings ...)
  2012-08-14 15:16 ` psyberbits at gmail dot com
@ 2012-08-14 15:24 ` carlos_odonell at mentor dot com
  2012-08-14 16:20 ` schwab@linux-m68k.org
  2014-06-13 14:01 ` fweimer at redhat dot com
  14 siblings, 0 replies; 16+ messages in thread
From: carlos_odonell at mentor dot com @ 2012-08-14 15:24 UTC (permalink / raw)
  To: glibc-bugs

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

Carlos O'Donell <carlos_odonell at mentor dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |WONTFIX

--- Comment #9 from Carlos O'Donell <carlos_odonell at mentor dot com> 2012-08-14 15:24:42 UTC ---
Thanks! Marking RESOLVED WONTFIX.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (12 preceding siblings ...)
  2012-08-14 15:24 ` carlos_odonell at mentor dot com
@ 2012-08-14 16:20 ` schwab@linux-m68k.org
  2014-06-13 14:01 ` fweimer at redhat dot com
  14 siblings, 0 replies; 16+ messages in thread
From: schwab@linux-m68k.org @ 2012-08-14 16:20 UTC (permalink / raw)
  To: glibc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WONTFIX                     |INVALID

--- Comment #10 from Andreas Schwab <schwab@linux-m68k.org> 2012-08-14 16:20:10 UTC ---
Not a bug.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14461] __m128i_strloadu_tolower returns unaligned __m128i
  2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
                   ` (13 preceding siblings ...)
  2012-08-14 16:20 ` schwab@linux-m68k.org
@ 2014-06-13 14:01 ` fweimer at redhat dot com
  14 siblings, 0 replies; 16+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 14:01 UTC (permalink / raw)
  To: glibc-bugs

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

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] 16+ messages in thread

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

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-13  1:00 [Bug libc/14461] New: __m128i_strloadu_tolower returns unaligned __m128i psyberbits at gmail dot com
2012-08-13  2:57 ` [Bug libc/14461] " john at pointysoftware dot net
2012-08-13  3:37 ` psyberbits at gmail dot com
2012-08-13  3:49 ` sh at lutzhaase dot com
2012-08-13 18:11 ` psyberbits at gmail dot com
2012-08-13 18:52 ` psyberbits at gmail dot com
2012-08-13 18:56 ` aj at suse dot de
2012-08-13 19:08 ` psyberbits at gmail dot com
2012-08-13 20:20 ` aj at suse dot de
2012-08-13 21:36 ` psyberbits at gmail dot com
2012-08-14  6:28 ` jakub at redhat dot com
2012-08-14 15:06 ` carlos_odonell at mentor dot com
2012-08-14 15:16 ` psyberbits at gmail dot com
2012-08-14 15:24 ` carlos_odonell at mentor dot com
2012-08-14 16:20 ` schwab@linux-m68k.org
2014-06-13 14:01 ` 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).