Bug 19006 - Make i486/i586 use vDSO syscall entry.
Summary: Make i486/i586 use vDSO syscall entry.
Status: REOPENED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-25 16:12 UTC by Andy Lutomirski
Modified: 2015-10-01 12:35 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Lutomirski 2015-09-25 16:12:04 UTC
This may be going *way* back, but:

i386 builds of glibc don't use AT_SYSINFO.  See:

https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/i386/dl-sysdep.h

The comment is nonsense -- the code simply calls int $0x80, which skips the vDSO entry and does the syscall directly.  On a genuine Pentium or earlier, on certain Pentium Pro chips, or on any AMD chip with a native 32-bit kernel, this is fine, and it even saves a couple cycles.  On any modern system, though, it adds hundreds of cycles.

Please consider using AT_SYSINFO on all glibc builds if the kernel advertises support.  That should work even on very old CPUs and kernels, it will speed up i386 builds on glibc running on newer CPUs, and it will even reduce code size, since you can combine the i386 and i686 dl-sysdep.h files into one.
Comment 1 Carlos O'Donell 2015-09-25 18:40:07 UTC
Presently we don't support building glibc for i386, the code in question is legacy support, the i686 dl-sysdep.h is always used, and therfore the vDSO entry is always used. See bug 10060 and bug 10062. You are correct that we could reduce code size by removing the legacy support. Please submit such a patch to libc-alpha@sourceware.org. Please ask questions on libc-help@sourceware.org instead of through the bugzilla.
Comment 2 Andy Lutomirski 2015-09-25 19:13:14 UTC
Somehow Debian's libc6 (as opposed to libc6-i686) is built without AT_SYSINFO support.  I don't know whether they patch it or whether glibc really can build the i386 dl-sysdep.h.
Comment 3 Joseph Myers 2015-09-25 19:53:26 UTC
Carlos, it's only i386 files overridden by i486 files that are dead, not those overridden by i686 files.  We support i486 and later; i386 sysdeps directories mean i486.  H.J. completed the move of sysdeps/i386/i486 files into sysdeps/i386, but the corresponding move in sysdeps/unix/sysv/linux/i386 hasn't been done yet.
Comment 4 Carlos O'Donell 2015-09-28 18:21:41 UTC
(In reply to Joseph Myers from comment #3)
> Carlos, it's only i386 files overridden by i486 files that are dead, not
> those overridden by i686 files.  We support i486 and later; i386 sysdeps
> directories mean i486.  H.J. completed the move of sysdeps/i386/i486 files
> into sysdeps/i386, but the corresponding move in
> sysdeps/unix/sysv/linux/i386 hasn't been done yet.


You're absolutely right, I see we don't have overrides for i486 and i586, which means those builds would use non-vDSO entry methods. Retitling issue. It shouldn't be hard for someone to fix by merging down the i686 dl-sysdep.h, and as you mention HJ might get to this.
Comment 5 cvs-commit@gcc.gnu.org 2015-09-30 17:14:03 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  f6d1d86d0c2cca118fd6a7734ea0ccd72b51c4b4 (commit)
      from  629d220d49e0842af2766808a131893efaf6ecda (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f6d1d86d0c2cca118fd6a7734ea0ccd72b51c4b4

commit f6d1d86d0c2cca118fd6a7734ea0ccd72b51c4b4
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Sep 30 10:12:26 2015 -0700

    Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386
    
    Since glibc doesn't support i386 any more, we can move
    sysdeps/unix/sysv/linux/i386/i486/*.? to i386.
    
    	[BZ #19006]
    	* sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Moved
    	to ...
    	* sysdeps/unix/sysv/linux/i386/libc-lowlevellock.S: Here.
    	* sysdeps/unix/sysv/linux/i386/i486/lll_timedlock_wait.c: Moved
    	to ...
    	* sysdeps/unix/sysv/linux/i386/lll_timedlock_wait.c: Here.
    	* sysdeps/unix/sysv/linux/i386/i486/lll_timedwait_tid.c: Moved
    	to ...
    	* sysdeps/unix/sysv/linux/i386/lll_timedwait_tid.c: Here.
    	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Moved to ...
    	* sysdeps/unix/sysv/linux/i386/lowlevellock.S: Here.
    	* sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Moved
    	to ...
    	* sysdeps/unix/sysv/linux/i386/lowlevelrobustlock.S: Here.
    	* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S:
    	Moved to ...
    	* sysdeps/unix/sysv/linux/i386/pthread_barrier_wait.S: Here.
    	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S:
    	Moved to ...
    	* sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S: Here.
    	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Moved
    	to ...
    	* sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S: Here.
    	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S:
    	Moved to ...
    	* sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S: Here.
    	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Moved
    	to ...
    	* sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S: Here.
    	* sysdeps/unix/sysv/linux/i386/i586/libc-lowlevellock.S:
    	Removed.
    	* sysdeps/unix/sysv/linux/i386/i586/lll_timedlock_wait.c:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i586/lll_timedwait_tid.c:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i586/lowlevellock.S: Likewise.
    	* sysdeps/unix/sysv/linux/i386/i586/lowlevelrobustlock.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i586/pthread_barrier_wait.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i686/libc-lowlevellock.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i686/lll_timedlock_wait.c:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i686/lll_timedwait_tid.c:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i686/lowlevellock.S: Likewise.
    	* sysdeps/unix/sysv/linux/i386/i686/lowlevelrobustlock.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i686/pthread_barrier_wait.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S:
    	Likewise.
    	* sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S:
    	Replace ../i486/pthread_cond_timedwait.S with
    	../pthread_cond_timedwait.S.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   72 ++++++++++++++++++++
 .../unix/sysv/linux/i386/i586/libc-lowlevellock.S  |    1 -
 .../unix/sysv/linux/i386/i586/lll_timedlock_wait.c |    1 -
 .../unix/sysv/linux/i386/i586/lll_timedwait_tid.c  |    1 -
 sysdeps/unix/sysv/linux/i386/i586/lowlevellock.S   |   19 -----
 .../unix/sysv/linux/i386/i586/lowlevelrobustlock.S |   19 -----
 .../sysv/linux/i386/i586/pthread_barrier_wait.S    |   19 -----
 .../sysv/linux/i386/i586/pthread_cond_broadcast.S  |   19 -----
 .../sysv/linux/i386/i586/pthread_cond_signal.S     |   19 -----
 .../sysv/linux/i386/i586/pthread_cond_timedwait.S  |   19 -----
 .../unix/sysv/linux/i386/i586/pthread_cond_wait.S  |   19 -----
 .../unix/sysv/linux/i386/i686/libc-lowlevellock.S  |    1 -
 .../unix/sysv/linux/i386/i686/lll_timedlock_wait.c |    1 -
 .../unix/sysv/linux/i386/i686/lll_timedwait_tid.c  |    1 -
 sysdeps/unix/sysv/linux/i386/i686/lowlevellock.S   |   19 -----
 .../unix/sysv/linux/i386/i686/lowlevelrobustlock.S |   19 -----
 .../sysv/linux/i386/i686/pthread_barrier_wait.S    |   19 -----
 .../sysv/linux/i386/i686/pthread_cond_broadcast.S  |   19 -----
 .../sysv/linux/i386/i686/pthread_cond_signal.S     |   19 -----
 .../sysv/linux/i386/i686/pthread_cond_timedwait.S  |    2 +-
 .../unix/sysv/linux/i386/i686/pthread_cond_wait.S  |   19 -----
 .../sysv/linux/i386/{i486 => }/libc-lowlevellock.S |    0
 .../linux/i386/{i486 => }/lll_timedlock_wait.c     |    0
 .../sysv/linux/i386/{i486 => }/lll_timedwait_tid.c |    0
 .../unix/sysv/linux/i386/{i486 => }/lowlevellock.S |    0
 .../linux/i386/{i486 => }/lowlevelrobustlock.S     |    0
 .../linux/i386/{i486 => }/pthread_barrier_wait.S   |    0
 .../linux/i386/{i486 => }/pthread_cond_broadcast.S |    0
 .../linux/i386/{i486 => }/pthread_cond_signal.S    |    0
 .../linux/i386/{i486 => }/pthread_cond_timedwait.S |    0
 .../sysv/linux/i386/{i486 => }/pthread_cond_wait.S |    0
 31 files changed, 73 insertions(+), 254 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i586/libc-lowlevellock.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i586/lll_timedlock_wait.c
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i586/lll_timedwait_tid.c
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i586/lowlevellock.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i586/lowlevelrobustlock.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i586/pthread_barrier_wait.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i686/libc-lowlevellock.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i686/lll_timedlock_wait.c
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i686/lll_timedwait_tid.c
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i686/lowlevellock.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i686/lowlevelrobustlock.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i686/pthread_barrier_wait.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S
 delete mode 100644 sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S
 rename sysdeps/unix/sysv/linux/i386/{i486 => }/libc-lowlevellock.S (100%)
 rename sysdeps/unix/sysv/linux/i386/{i486 => }/lll_timedlock_wait.c (100%)
 rename sysdeps/unix/sysv/linux/i386/{i486 => }/lll_timedwait_tid.c (100%)
 rename sysdeps/unix/sysv/linux/i386/{i486 => }/lowlevellock.S (100%)
 rename sysdeps/unix/sysv/linux/i386/{i486 => }/lowlevelrobustlock.S (100%)
 rename sysdeps/unix/sysv/linux/i386/{i486 => }/pthread_barrier_wait.S (100%)
 rename sysdeps/unix/sysv/linux/i386/{i486 => }/pthread_cond_broadcast.S (100%)
 rename sysdeps/unix/sysv/linux/i386/{i486 => }/pthread_cond_signal.S (100%)
 rename sysdeps/unix/sysv/linux/i386/{i486 => }/pthread_cond_timedwait.S (100%)
 rename sysdeps/unix/sysv/linux/i386/{i486 => }/pthread_cond_wait.S (100%)