1. 18 6月, 2014 2 次提交
    • R
      fix powerpc dynamic linker thread-pointer-relative relocations · 94cf991b
      Rich Felker 提交于
      processing of R_PPC_TPREL32 was ignoring the addend provided by the
      RELA-style relocation and instead using the inline value as the
      addend. this presumably broke dynamic-linked access to initial TLS in
      cases where the addend was nonzero.
      94cf991b
    • R
      multiple fixes to sh (superh) dynamic linker relocations · f4cc2760
      Rich Felker 提交于
      the following issues are fixed:
      
      - R_SH_REL32 was adding the load address of the module being relocated
        to the result. this seems to have been a mistake in the original
        port, since it does not match other dynamic linker implementations
        and since adding a difference between two addresses (the symbol
        value and the relocation address) to a load address does not make
        sense.
      
      - R_SH_TLS_DTPMOD32 was wrongly accepting an inline addend (i.e. using
        += rather than = on *reloc_addr) which makes no sense; addition is
        not an operation that's defined on module ids.
      
      - R_SH_TLS_DTPOFF32 and R_SH_TLS_TPOFF32 were wrongly using inline
        addends rather than the RELA-provided addends.
      
      in addition, handling of R_SH_GLOB_DAT, R_SH_JMP_SLOT, and R_SH_DIR32
      are merged to all honor the addend. the first two should not need it
      for correct usage generated by toolchains, but other dynamic linkers
      allow addends here, and it simplifies the code anyway.
      
      these issues were spotted while reviewing the code for the purpose of
      refactoring this part of the dynamic linker. no testing was performed.
      f4cc2760
  2. 16 6月, 2014 1 次提交
    • R
      dynamic linker: permit error returns from arch-specific reloc function · bfa09700
      Rich Felker 提交于
      the immediate motivation is supporting TLSDESC relocations which
      require allocation and thus may fail (unless we pre-allocate), but
      this mechanism should also be used for throwing an error on
      unsupported or invalid relocation types, and perhaps in certain cases,
      for reporting when a relocation is not satisfiable.
      bfa09700
  3. 06 6月, 2014 1 次提交
  4. 31 5月, 2014 1 次提交
    • S
      add sched_{get,set}attr syscall numbers and SCHED_DEADLINE macro · fd9571e2
      Szabolcs Nagy 提交于
      linux 3.14 introduced sched_getattr and sched_setattr syscalls in
      commit d50dde5a10f305253cbc3855307f608f8a3c5f73
      
      and the related SCHED_DEADLINE scheduling policy in
      commit aab03e05e8f7e26f51dee792beddcb5cca9215a5
      
      but struct sched_attr "extended scheduling parameters data structure"
      is not yet exported to userspace (necessary for using the syscalls)
      so related uapi definitions are not added yet.
      fd9571e2
  5. 30 5月, 2014 1 次提交
    • S
      fix for broken kernel side RLIM_INFINITY on mips · 8258014f
      Szabolcs Nagy 提交于
      On 32 bit mips the kernel uses -1UL/2 to mark RLIM_INFINITY (and
      this is the definition in the userspace api), but since it is in
      the middle of the valid range of limits and limits are often
      compared with relational operators, various kernel side logic is
      broken if larger than -1UL/2 limits are used. So we truncate the
      limits to -1UL/2 in get/setrlimit and prlimit.
      
      Even if the kernel side logic consistently treated -1UL/2 as greater
      than any other limit value, there wouldn't be any clean workaround
      that allowed using large limits:
      * using -1UL/2 as RLIM_INFINITY in userspace would mean different
      infinity value for get/setrlimt and prlimit (where infinity is always
      -1ULL) and userspace logic could break easily (just like the kernel
      is broken now) and more special case code would be needed for mips.
      * translating -1UL/2 kernel side value to -1ULL in userspace would
      mean that -1UL/2 limit cannot be set (eg. -1UL/2+1 had to be passed
      to the kernel instead).
      8258014f
  6. 01 5月, 2014 2 次提交
  7. 18 4月, 2014 1 次提交
  8. 16 4月, 2014 3 次提交
    • R
      add working vdso clock_gettime support, including static linking · 58e75db4
      Rich Felker 提交于
      the vdso symbol lookup code is based on the original 2011 patch by
      Nicholas J. Kain, with some streamlining, pointer arithmetic fixes,
      and one symbol version matching fix.
      
      on the consumer side (clock_gettime), per-arch macros for the
      particular symbol name and version to lookup are added in
      syscall_arch.h, and no vdso code is pulled in on archs which do not
      define these macros. at this time, vdso is enabled only on x86_64.
      
      the vdso support at the dynamic linker level is no longer useful to
      libc, but is left in place for the sake of debuggers (which may need
      the vdso in the link map to find its functions) and possibly use with
      dlsym.
      58e75db4
    • S
      fix RLIMIT_ constants for mips · fcea534e
      Szabolcs Nagy 提交于
      The mips arch is special in that it uses different RLIMIT_
      numbers than other archs, so allow bits/resource.h to override
      the default RLIMIT_ numbers (empty on all archs except mips).
      Reported by orc.
      fcea534e
    • R
      add namespace-protected name for sysinfo function · de20a8ff
      Rich Felker 提交于
      it will be needed to implement some things in sysconf, and the syscall
      can't easily be used directly because the x32 syscall uses the wrong
      structure layout. the l (uncreative, for "linux") prefix is used since
      the symbol name __sysinfo is already taken for AT_SYSINFO from the aux
      vector.
      
      the way the x32 override of this function works is also changed to be
      simpler and avoid the useless jump instruction.
      de20a8ff
  9. 15 4月, 2014 1 次提交
    • R
      use dmb barrier instruction for atomics on arm v7 · 3933fdd5
      Rich Felker 提交于
      aside from potentially offering better performance, this change is
      needed since the old coprocessor-based approach to barriers is
      deprecated in arm v7, and some compilers/assemblers issue errors when
      using the deprecated instruction for v7 targets.
      3933fdd5
  10. 07 4月, 2014 2 次提交
    • R
      fix arm atomic asm register constraint · efe07b0f
      Rich Felker 提交于
      the "m" constraint could give a memory reference with an offset that's
      not compatible with ldrex/strex, so the arm-specific "Q" constraint is
      needed instead.
      efe07b0f
    • R
      use inline atomics and thread pointer on arm models supporting them · 1974bffa
      Rich Felker 提交于
      this is perhaps not the optimal implementation; a_cas still compiles
      to nested loops due to the different interface contracts of the kuser
      helper cas function (whose contract this patch implements) and the
      a_cas function (whose contract mimics the x86 cmpxchg). fixing this
      may be possible, but it's more complicated and thus deferred until a
      later time.
      
      aside from improving performance and code size, this patch also
      provides a means of producing binaries which can run on hardened
      kernels where the kuser helpers have been disabled. however, at
      present this requires producing binaries for armv6k or later, which
      will not run on older cpus. a real solution to the problem of kernels
      that omit the kuser helpers would be runtime detection, so that
      universal binaries which run on all arm cpu models can also be
      compatible with all kernel hardening profiles. robust detection
      however is a much harder problem, and will be addressed at a later
      time.
      1974bffa
  11. 03 4月, 2014 1 次提交
    • R
      fix microblaze syscall register clobbers · 91d5aa06
      Rich Felker 提交于
      the kernel entry point for syscalls on microblaze nominally saves and
      restores all registers, and testing on qemu always worked since qemu
      behaves this way too. however, the real kernel treats r3:r4 as a
      potential 64-bit return value from the syscall function, and copies
      both over top of the saved registers before returning to userspace.
      thus, we need to treat r4 as always-clobbered.
      91d5aa06
  12. 19 3月, 2014 6 次提交
  13. 18 3月, 2014 1 次提交
    • R
      x32: fix struct statfs · 797f9a32
      rofl0r 提交于
      the omission of the padding was uncovered by the latest regression
      statvfs regression test added to libc-test.
      797f9a32
  14. 17 3月, 2014 1 次提交
    • B
      superh: fix dynamic linking of __fpscr_values · 611eabd4
      Bobby Bingham 提交于
      Applications ended up with copy relocations for this array, which
      resulted in libc's references to this array pointing to the
      application's copy.  The dynamic linker, however, can require this array
      before the application is relocated, and therefore before the
      application's copy of this array is initialized.  This resulted in
      garbage being loaded into FPSCR before executing main, which violated
      the ABI.
      
      We fix this by putting the array in crt1 and making the libc copy
      private.  This prevents libc's reference to the array from pointing to
      an uninitialized copy in the application.
      611eabd4
  15. 13 3月, 2014 1 次提交
    • S
      fix statfs struct on mips · 7673acd3
      Szabolcs Nagy 提交于
      The mips statfs struct layout is different than on other archs, so the
      statfs, fstatfs, statvfs and fstatvfs APIs were broken on mips.
      Now the ordering is fixed, the types are kept consistent with other archs.
      7673acd3
  16. 12 3月, 2014 4 次提交
    • S
      fix semid_ds structure on mips · 3ceb89ed
      Szabolcs Nagy 提交于
      This used to be broken when all archs had the same semid_ds definition:
      there is no padding around the time_t members on mips.
      3ceb89ed
    • R
      fix socket.h struct msghdr member types on powerpc · 514c2dd2
      Rich Felker 提交于
      these were incorrectly copied from the kernel, whose ABI matches the
      POSIX requirements but with the wrong underlying types and wrong
      signedness.
      514c2dd2
    • R
      fix sysvipc structures on powerpc · ad66ae93
      Rich Felker 提交于
      these have been wrong for a long time and were never detected or
      corrected. powerpc needs some gratuitous extra padding/reserved slots
      in ipc_perm, big-endian ordering for the padding of time_t slots that
      was intended by the kernel folks to allow a transition to 64-bit
      time_t, and some minor gratuitous reordering of struct members.
      ad66ae93
    • R
      move struct semid_ds to from shared sys/sem.h to bits · f6e2f7e1
      Rich Felker 提交于
      the definition was found to be incorrect at least for powerpc, and
      fixing this cleanly requires making the definition arch-specific. this
      will allow cleaning up the definition for other archs to make it more
      specific, and reversing some of the ugliness (time_t hacks) introduced
      with the x32 port.
      
      this first commit simply copies the existing definition to each arch
      without any changes. this is intentional, to make it easier to review
      changes made on a per-arch basis.
      f6e2f7e1
  17. 08 3月, 2014 1 次提交
  18. 06 3月, 2014 1 次提交
    • R
      x32: fix sysinfo() · dae8ca73
      rofl0r 提交于
      the kernel uses long longs in the struct, but the documentation
      says they're long. so we need to fixup the mismatch between the
      userspace and kernelspace structs.
      since the struct offers a mem_unit member, we can avoid truncation
      by adjusting that value.
      dae8ca73
  19. 28 2月, 2014 3 次提交
  20. 25 2月, 2014 2 次提交
    • S
      mips: add mips-sf subarch support (soft-float) · e5bb165b
      Szabolcs Nagy 提交于
      Userspace emulated floating-point (gcc -msoft-float) is not compatible
      with the default mips abi (assumes an FPU or in kernel emulation of it).
      Soft vs hard float abi should not be mixed, __mips_soft_float is checked
      in musl's configure script and there is no runtime check. The -sf subarch
      does not save/restore floating-point registers in setjmp/longjmp and only
      provides dummy fenv implementation.
      e5bb165b
    • R
      fixup general __syscall breakage introduced in x32 port · dbed3924
      rofl0r 提交于
      the reordering of headers caused some risc archs to not see
      the __syscall declaration anymore.
      this caused build errors on mips with any compiler,
      and on arm and microblaze with clang.
      
      we now declare it locally just like the powerpc port does.
      dbed3924
  21. 24 2月, 2014 3 次提交
  22. 23 2月, 2014 1 次提交
    • R
      fix some issues in x32 syscall_cp_fixup · e002f660
      rofl0r 提交于
      - the nanosleep fixup "fixed" the second timespec* argument erroneusly.
      - the futex fixup was missing the check for FUTEX_WAIT.
      - general cleanup using a macro.
      e002f660