glibc:hjl/pr19363/master

Last commit made on 2015-12-16
Get this branch:
git clone -b hjl/pr19363/master https://git.launchpad.net/glibc

Branch merges

Branch information

Name:
hjl/pr19363/master
Repository:
lp:glibc

Recent commits

4c0dfef... by "H.J. Lu" <email address hidden>

Use INTERNAL_SYSCALL_TIMES* macros for Linux times

The Linux times function, which returns clock_t, is implemented with
INTERNAL_SYSCALL_DECL, INTERNAL_SYSCALL, INTERNAL_SYSCALL_ERROR_P and
INTERNAL_SYSCALL_ERRNO. Since INTERNAL_SYSCALL* macros use 32-bit
integer and clock_t is 64-bit on x32, this is a mismatch on x32. All
system calls returning 64-bit integer, which are lseek, time and times,
must be handled specially for x32. lseek is handled by x32 lseek.S and
time doesn't check syscall return. times is the only missed one.

This patch replaces INTERNAL_SYSCALL* macros in Linux times.c with
INTERNAL_SYSCALL_TIMES* macros which are default to INTERNAL_SYSCALL*
macros and provides x32 times.c with proper INTERNAL_SYSCALL_TIMES*
macros.

There is no code change on times for i686 nor x86-64. For x32, before
this patch, there are

0000000 <__times>:
   0: b8 64 00 00 40 mov $0x40000064,%eax
   5: 0f 05 syscall
   7: 48 63 d0 movslq %eax,%rdx
                                ^^^^^^^^^^ Incorrect signed extension
   a: 48 83 fa f2 cmp $0xfffffffffffffff2,%rdx
   e: 75 07 jne 17 <__times+0x17>
  10: 3d 00 f0 ff ff cmp $0xfffff000,%eax
                                ^^^^^^^^^^^^^^^^^^^^^ 32-bit compare
  15: 77 11 ja 28 <__times+0x28>
  17: 48 83 fa ff cmp $0xffffffffffffffff,%rdx
  1b: b8 00 00 00 00 mov $0x0,%eax
  20: 48 0f 45 c2 cmovne %rdx,%rax
  24: c3 retq

After this patch, there are

00000000 <__times>:
   0: b8 64 00 00 40 mov $0x40000064,%eax
   5: 0f 05 syscall
   7: 48 83 f8 f2 cmp $0xfffffffffffffff2,%rax
   b: 75 08 jne 15 <__times+0x15>
   d: 48 3d 00 f0 ff ff cmp $0xfffffffffffff000,%rax
  13: 77 13 ja 28 <__times+0x28>
  15: 48 83 f8 ff cmp $0xffffffffffffffff,%rax
  19: ba 00 00 00 00 mov $0x0,%edx
  1e: 48 0f 44 c2 cmove %rdx,%rax
  22: c3 retq

The incorrect signed extension and 32-bit compare are gone.

 [BZ #19363]
 * sysdeps/unix/sysv/linux/times.c (INTERNAL_SYSCALL_TIMES_DECL):
 New.
 (INTERNAL_SYSCALL_TIMES): Likewise.
 (INTERNAL_SYSCALL_TIMES_ERROR_P): Likewise.
 (INTERNAL_SYSCALL_TIMES_ERRNO): Likewise.
 (__times): Replace INTERNAL_SYSCALL* macros with
 INTERNAL_SYSCALL_TIMES* macros.
 * sysdeps/unix/sysv/linux/x86_64/x32/times.c: New file.

d29d57e... by "H.J. Lu" <email address hidden>

Add REGISTERS_CLOBBERED_BY_SYSCALL for x86-64

X86-64 system calls use a different calling convention, which clobbers
CC, %r11 an %rcx registers. Define REGISTERS_CLOBBERED_BY_SYSCALL for
x86-64 inline asm statements.

 * sysdeps/unix/sysv/linux/x86_64/sysdep.h
 (REGISTERS_CLOBBERED_BY_SYSCALL): New.
 (INTERNAL_SYSCALL_NCS): Use it.
 (INTERNAL_SYSCALL_NCS_TYPES): Likewise.

3da825c... by Florian Weimer

malloc: Fix attached thread reference count handling [BZ #19243]

reused_arena can increase the attached thread count of arenas on the
free list. This means that the assertion that the reference count is
zero is incorrect. In this case, the reference count initialization
is incorrect as well and could cause arenas to be put on the free
list too early (while they still have attached threads).

 * malloc/arena.c (get_free_list): Remove assert and adjust
 reference count handling. Add comment about reused_arena
 interaction.
 (reused_arena): Add comments abount get_free_list interaction.
 * malloc/tst-malloc-thread-exit.c: New file.
 * malloc/Makefile (tests): Add tst-malloc-thread-exit.
 (tst-malloc-thread-exit): Link against libpthread.

f1aceee... by "H.J. Lu" <email address hidden>

Add missing ChangeLog entries

b9eb92a... by "H.J. Lu" <email address hidden>

Add Prefer_MAP_32BIT_EXEC to map executable pages with MAP_32BIT

According to Silvermont software optimization guide, for 64-bit
applications, branch prediction performance can be negatively impacted
when the target of a branch is more than 4GB away from the branch. Add
the Prefer_MAP_32BIT_EXEC bit so that mmap will try to map executable
pages with MAP_32BIT first. NB: MAP_32BIT will map to lower 2GB, not
lower 4GB, address. Prefer_MAP_32BIT_EXEC reduces bits available for
address space layout randomization (ASLR), which is always disabled for
SUID programs and can only be enabled by setting environment variable,
LD_PREFER_MAP_32BIT_EXEC.

On Fedora 23, this patch speeds up GCC 5 testsuite by 3% on Silvermont.

 [BZ #19367]
 * sysdeps/unix/sysv/linux/wordsize-64/mmap.c: New file.
 * sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h: Likewise.
 * sysdeps/unix/sysv/linux/x86_64/64/mmap.c: Likewise.
 * sysdeps/x86/cpu-features.h (bit_Prefer_MAP_32BIT_EXEC): New.
 (index_Prefer_MAP_32BIT_EXEC): Likewise.

c9afcaa... by "H.J. Lu" <email address hidden>

Enable Silvermont optimizations for Knights Landing

Knights Landing processor is based on Silvermont. This patch enables
Silvermont optimizations for Knights Landing.

 * sysdeps/x86/cpu-features.c (init_cpu_features): Enable
 Silvermont optimizations for Knights Landing.

42d6443... by Andreas Schwab <email address hidden>

Don't emit invalid extra shift character at block boundary by iconv (bug 17197)

04ae79a... by Florian Weimer

Fix aliasing violation in tst-rec-dlopen

eed3e1e... by Joseph Myers <email address hidden>

Make obsolete syscall wrappers into compat symbols (bug 18472).

Various Linux kernel syscalls have become obsolete over time.
Specifically, the following are obsolete in all kernel versions
supported by glibc, are not present for architectures more recently
added to the kernel, and as such, the wrapper functions for them
should be compat symbols, not in static libc and not available for new
links with shared libc.

* bdflush: in Linux 2.6, does nothing if present.

* create_module get_kernel_syms query_module: Linux 2.4 module
  interface, syscalls not present in Linux 2.6.

* uselib: part of the mechanism for loading a.out shared libraries,
  irrelevant with ELF.

This patch adds support for syscalls.list to list syscall aliases of
the form NAME@VERSION:OBSOLETED, with SHLIB_COMPAT conditionals being
generated for such aliases. Those five syscalls are then made into
compat symbols (obsoleted in glibc 2.23, so future ports won't have
these symbols at all), with the header <sys/kdaemon.h> declaring
bdflush being removed. When we move to 3.2 as minimum kernel version,
the same can be done for nfsservctl (removed in Linux 3.1) as well.

Tested for x86_64 and x86 (testsuite, as well as checking that the
symbols in question indeed become compat symbols, that they are indeed
omitted from static libc, and that the generated SHLIB_COMPAT
conditionals look right).

 [BZ #18472]
 * sysdeps/unix/Makefile ($(objpfx)stub-syscalls.c): Handle entries
 for the form NAME@VERSION:OBSOLETED and generate SHLIB_COMPAT
 conditionals for them.
 * sysdeps/unix/make-syscalls.sh (emit_weak_aliases): Likewise.
 * sysdeps/unix/sysv/linux/sys/kdaemon.h: Remove file.
 * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Remove
 sys/kdaemon.h.
 * sysdeps/unix/sysv/linux/syscalls.list (bdflush): Make into
 compat-only syscall, obsoleted in glibc 2.23.
 (create_module): Likewise.
 (get_kernel_syms): Likewise.
 (query_module): Likewise.
 (uselib): Likewise.
 * manual/sysinfo.texi (System Parameters): Do not mention bdflush.

5db0877... by Aurelien Jarno <email address hidden>

Cleanup ARM ioperm implementation

Since GLIBC requires a minimum 2.6.32 kernel, the patch cleanups
the ARM ioperm by removing pre-2.4.23 kernel support.