1. 03 4月, 2021 1 次提交
    • X
      signal · c78edff7
      x_xiny 提交于
      Change-Id: Iacf0cc5918e3aad5def71aedbd048bd5d21ccca5
      c78edff7
  2. 11 3月, 2021 1 次提交
  3. 09 9月, 2020 1 次提交
  4. 31 8月, 2020 1 次提交
  5. 18 8月, 2020 1 次提交
  6. 17 8月, 2020 1 次提交
  7. 08 12月, 2019 1 次提交
  8. 18 8月, 2019 1 次提交
  9. 30 7月, 2019 1 次提交
    • R
      setitimer, getitimer: decouple time_t from long · 558c0133
      Rich Felker 提交于
      these functions have no new time64 syscall, so the existence of a
      time64 syscall cannot be used as the condition for the new code.
      instead, assume the syscall takes timevals as longs, which is true
      everywhere but x32, and interface with the kernel through long[4]
      objects.
      
      rather than adding new hacks to special-case x32 here, just add
      x32-specific source files since a trivial syscall wrapper suffices
      there.
      
      the new code paths added in this commit are statically unreachable on
      all current archs, but will become reachable when 32-bit archs get
      64-bit time_t.
      558c0133
  10. 29 7月, 2019 1 次提交
    • R
      sigtimedwait: add time64 syscall support, decouple 32-bit time_t · 68c98391
      Rich Felker 提交于
      time64 syscall is used only if it's the only one defined for the arch,
      or if the requested timeout length does not fit in 32 bits. on current
      32-bit archs where time_t is a 32-bit type, this makes it statically
      unreachable.
      
      on 64-bit archs, there are only superficial changes to the code after
      preprocessing. on current 32-bit archs, the timeout is passed via an
      intermediate copy to remove the assumption that time_t is a 32-bit
      type.
      68c98391
  11. 13 7月, 2019 1 次提交
  12. 11 7月, 2019 1 次提交
  13. 15 6月, 2019 1 次提交
    • R
      add riscv64 architecture support · 0a48860c
      Rich Felker 提交于
      Author: Alex Suykov <alex.suykov@gmail.com>
      Author: Aric Belsito <lluixhi@gmail.com>
      Author: Drew DeVault <sir@cmpwn.com>
      Author: Michael Clark <mjc@sifive.com>
      Author: Michael Forney <mforney@mforney.org>
      Author: Stefan O'Rear <sorear2@gmail.com>
      
      This port has involved the work of many people over several years. I
      have tried to ensure that everyone with substantial contributions has
      been credited above; if any omissions are found they will be noted
      later in an update to the authors/contributors list in the COPYRIGHT
      file.
      
      The version committed here comes from the riscv/riscv-musl repo's
      commit 3fe7e2c75df78eef42dcdc352a55757729f451e2, with minor changes by
      me for issues found during final review:
      
      - a_ll/a_sc atomics are removed (according to the ISA spec, lr/sc
        are not safe to use in separate inline asm fragments)
      
      - a_cas[_p] is fixed to be a memory barrier
      
      - the call from the _start assembly into the C part of crt1/ldso is
        changed to allow for the possibility that the linker does not place
        them nearby each other.
      
      - DTP_OFFSET is defined correctly so that local-dynamic TLS works
      
      - reloc.h LDSO_ARCH logic is simplified and made explicit.
      
      - unused, non-functional crti/n asm files are removed.
      
      - an empty .sdata section is added to crt1 so that the
        __global_pointer reference is resolvable.
      
      - indentation style errors in some asm files are fixed.
      0a48860c
  14. 06 3月, 2019 1 次提交
    • R
      don't reject unknown/future flags in sigaltstack, allow SS_AUTODISARM · 4918b7fb
      Rich Felker 提交于
      historically, and likely accidentally, sigaltstack was specified to
      fail with EINVAL if any flag bit other than SS_DISABLE was set. the
      resolution of Austin Group issue 1187 fixes this so that the
      requirement is only to fail for SS_ONSTACK (which cannot be set) or
      "invalid" flags.
      
      Linux fails on the kernel side for invalid flags, but historically
      accepts SS_ONSTACK as a no-op, so it needs to be rejected in userspace
      still.
      
      with this change, the Linux-specific SS_AUTODISARM, provided since
      commit 9680e1d0 but unusable due to
      rejection at runtime, is now usable.
      4918b7fb
  15. 19 12月, 2018 1 次提交
    • R
      add __timedwait backend workaround for old kernels where futex EINTRs · a63c0104
      Rich Felker 提交于
      prior to linux 2.6.22, futex wait could fail with EINTR even for
      non-interrupting (SA_RESTART) signals. this was no problem provided
      the caller simply restarted the wait, but sem_[timed]wait is required
      by POSIX to return when interrupted by a signal. commit
      a113434c introduced this behavior, and
      commit c0ed5a20 reverted it based on a
      mistaken belief that it was not required. this belief stems from a bug
      in the specification: the description requires the function to return
      when interrupted, but the errors section marks EINTR as a "may fail"
      condition rather than a "shall fail" one.
      
      since there does seem to be significant value in the change made in
      commit c0ed5a20, making it so that
      programs that call sem_wait without checking for EINTR don't silently
      make forward progress without obtaining the semaphore or treat it as a
      fatal error and abort, add a behind-the-scenes mechanism in the
      __timedwait backend to suppress EINTR in programs that have never
      installed interrupting signal handlers, and have sigaction track and
      report this state. this way the semaphore code is not cluttered by
      workarounds and can be updated (to be done in next commit) to reflect
      the high-level logic for conforming behavior.
      
      these changes are based loosely on a patch by Markus Wichmann, with
      the main changes being atomic update to flag object and moving the
      workaround from sem_timedwait to the __timedwait futex backend.
      a63c0104
  16. 13 9月, 2018 4 次提交
    • R
      split internal lock API out of libc.h, creating lock.h · 5f12ffe1
      Rich Felker 提交于
      this further reduces the number of source files which need to include
      libc.h and thereby be potentially exposed to libc global state and
      internals.
      
      this will also facilitate further improvements like adding an inline
      fast-path, if we want to do so later.
      5f12ffe1
    • R
      reduce spurious inclusion of libc.h · 5ce37379
      Rich Felker 提交于
      libc.h was intended to be a header for access to global libc state and
      related interfaces, but ended up included all over the place because
      it was the way to get the weak_alias macro. most of the inclusions
      removed here are places where weak_alias was needed. a few were
      recently introduced for hidden. some go all the way back to when
      libc.h defined CANCELPT_BEGIN and _END, and all (wrongly implemented)
      cancellation points had to include it.
      
      remaining spurious users are mostly callers of the LOCK/UNLOCK macros
      and files that use the LFS64 macro to define the awful *64 aliases.
      
      in a few places, new inclusion of libc.h is added because several
      internal headers no longer implicitly include libc.h.
      
      declarations for __lockfile and __unlockfile are moved from libc.h to
      stdio_impl.h so that the latter does not need libc.h. putting them in
      libc.h made no sense at all, since the macros in stdio_impl.h are
      needed to use them correctly anyway.
      5ce37379
    • R
      apply hidden visibility to sigreturn code fragments · b6e59cd9
      Rich Felker 提交于
      these were overlooked in the declarations overhaul work because they
      are not properly declared, and the current framework even allows their
      declared types to vary by arch. at some point this should be cleaned
      up, but I'm not sure what the right way would be.
      b6e59cd9
    • R
      overhaul internally-public declarations using wrapper headers · 13d1afa4
      Rich Felker 提交于
      commits leading up to this one have moved the vast majority of
      libc-internal interface declarations to appropriate internal headers,
      allowing them to be type-checked and setting the stage to limit their
      visibility. the ones that have not yet been moved are mostly
      namespace-protected aliases for standard/public interfaces, which
      exist to facilitate implementing plain C functions in terms of POSIX
      functionality, or C or POSIX functionality in terms of extensions that
      are not standardized. some don't quite fit this description, but are
      "internally public" interfacs between subsystems of libc.
      
      rather than create a number of newly-named headers to declare these
      functions, and having to add explicit include directives for them to
      every source file where they're needed, I have introduced a method of
      wrapping the corresponding public headers.
      
      parallel to the public headers in $(srcdir)/include, we now have
      wrappers in $(srcdir)/src/include that come earlier in the include
      path order. they include the public header they're wrapping, then add
      declarations for namespace-protected versions of the same interfaces
      and any "internally public" interfaces for the subsystem they
      correspond to.
      
      along these lines, the wrapper for features.h is now responsible for
      the definition of the hidden, weak, and weak_alias macros. this means
      source files will no longer need to include any special headers to
      access these features.
      
      over time, it is my expectation that the scope of what is "internally
      public" will expand, reducing the number of source files which need to
      include *_impl.h and related headers down to those which are actually
      implementing the corresponding subsystems, not just using them.
      13d1afa4
  17. 06 9月, 2018 1 次提交
    • R
      define and use internal macros for hidden visibility, weak refs · 9b95fd09
      Rich Felker 提交于
      this cleans up what had become widespread direct inline use of "GNU C"
      style attributes directly in the source, and lowers the barrier to
      increased use of hidden visibility, which will be useful to recovering
      some of the efficiency lost when the protected visibility hack was
      dropped in commit dc2f368e, especially
      on archs where the PLT ABI is costly.
      9b95fd09
  18. 02 9月, 2018 1 次提交
  19. 01 9月, 2018 2 次提交
    • R
      always terminate by SIGABRT when abort is called · 9b14ad54
      Rich Felker 提交于
      Linux makes this surprisingly difficult, but it can be done. the trick
      here is using the fact that we control the implementation of sigaction
      to prevent changing the disposition of SIGABRT to anything but SIG_DFL
      after abort has tried and failed to terminate the process simply by
      calling raise(SIGABRT).
      9b14ad54
    • R
      optimize raise not to make a syscall for getting tid · 0b4c92b7
      Rich Felker 提交于
      assuming signals are blocked, which they are here, the tid in the
      thread structure is always valid and cannot change out from under us.
      0b4c92b7
  20. 30 8月, 2018 1 次提交
    • R
      prevent psignal/psiginfo from clobbering stderr orientation, errno · cd8d8309
      Rich Felker 提交于
      these functions are specified to write to stderr but not set its
      orientation, presumably so that they can be used in programs operating
      stderr in wide mode. also, they are not allowed to clobber errno on
      success. save and restore to meet the requirement.
      
      psiginfo is reduced to a think wrapper around psignal, since it
      already behaved the same. if we want to add more detailed siginfo
      printing at some point this will need refactoring.
      cd8d8309
  21. 20 6月, 2018 1 次提交
    • R
      add m68k port · f81e44a0
      Rich Felker 提交于
      three ABIs are supported: the default with 68881 80-bit fpu format and
      results returned in floating point registers, softfloat-only with the
      same format, and coldfire fpu with IEEE single/double only. only the
      first is tested at all, and only under qemu which has fpu emulation
      bugs.
      
      basic functionality smoke tests have been performed for the most
      common arch-specific breakage via libc-test and qemu user-level
      emulation. some sysvipc failures remain, but are shared with other big
      endian archs and will be fixed separately.
      f81e44a0
  22. 02 5月, 2018 1 次提交
    • R
      optimize sigisemptyset · 941bd884
      Rich Felker 提交于
      the static const zero set ended up getting put in bss instead of
      rodata, wasting writable memory, and the call to memcmp was
      size-inefficient. generally for nonstandard extension functions we try
      to avoid poking at any internals directly, but the way the zero set
      was setup was arguably already doing so.
      941bd884
  23. 26 2月, 2018 1 次提交
    • R
      add public interface headers to implementation files · 57b97b42
      Rich Felker 提交于
      general policy is that all source files defining a public API or an
      ABI mechanism referenced by a public header should include the public
      header that declares the interface, so that the compiler or analysis
      tools can check the consistency of the declarations. Alexander Monakov
      pointed out a number of violations of this principle a few years back.
      fix them now.
      57b97b42
  24. 12 8月, 2017 1 次提交
    • B
      ppc64: fix setjmp/longjmp handling of TOC pointer · e31c8c2d
      Bobby Bingham 提交于
      The TOC pointer is constant within a single dso, but needs to be saved
      and restored around cross-dso calls.  The PLT stub saves it to the
      caller's stack frame, and the linker adds code to the caller to restore
      it.
      
      With a local call, as within a single dso or with static linking, this
      doesn't happen and the TOC pointer is always in r2.  Therefore,
      setjmp/longjmp need to save/restore the TOC pointer from/to different
      locations depending on whether the call to setjmp was a local or non-local
      call.
      
      It is always safe for longjmp to restore to both r2 and the caller's stack.
      If the call to setjmp was local, and only r2 matters and the stack location
      will be ignored, but is required by the ABI to be reserved for the TOC
      pointer.  If the call was non-local, then only the stack location matters,
      and whatever is restored into r2 will be clobbered anyway when the caller
      reloads r2 from the stack.
      
      A little extra care is required for sigsetjmp, because it uses setjmp
      internally.  After the second return from this setjmp call, r2 will contain
      the caller's TOC pointer instead of libc's TOC pointer.  We need to save
      and restore the correct libc pointer before we can tail call to
      __sigsetjmp_tail.
      e31c8c2d
  25. 17 12月, 2016 1 次提交
    • B
      fix crashing sigsetjmp on s390x · c1020cf2
      Bobby Bingham 提交于
      the bz instruction that was wrongly used only admits a small immediate
      displacement and cannot be used with external symbols; apparently the
      linker fails to diagnose the overflow.
      c1020cf2
  26. 13 11月, 2016 1 次提交
    • R
      work around gdb issues recognizing sigreturn trampoline on x86_64 · 54991729
      Rich Felker 提交于
      gdb can only backtrace/unwind across signal handlers if it recognizes
      the sa_restorer trampoline. for x86_64, gdb first attempts to
      determine the symbol name for the function in which the program
      counter resides and match it against "__restore_rt". if no name can be
      found (e.g. in the case of a stripped binary), the exact instruction
      sequence is matched instead.
      
      when matching the function name, however, gdb's unwind code wrongly
      considers the interval [sym,sym+size] rather than [sym,sym+size).
      thus, if __restore_rt begins immediately after another function, gdb
      wrongly identifies pc as lying within the previous adjacent function.
      this patch adds a nop before __restore_rt to preclude that
      possibility. it also removes the symbol name __restore and replaces it
      with a macro since the stability of whether gdb identifies the
      function as __restore_rt or __restore is not clear.
      
      for the no-symbols case, the instruction sequence is changed to use
      %rax rather than %eax to match what gdb expects.
      
      based on patch by Szabolcs Nagy, with extended description and
      corresponding x32 changes added.
      54991729
  27. 12 11月, 2016 1 次提交
  28. 09 5月, 2016 1 次提交
  29. 18 4月, 2016 1 次提交
  30. 07 3月, 2016 1 次提交
    • R
      add mips64 port · 83933573
      Rich Felker 提交于
      patch by Mahesh Bodapati and Jaydeep Patil of Imagination
      Technologies.
      83933573
  31. 16 12月, 2015 1 次提交
  32. 12 11月, 2015 1 次提交
    • R
      eliminate use of SHARED macro to suppress visibility attributes · 8a8fdf63
      Rich Felker 提交于
      this is the first and simplest stage of removal of the SHARED macro,
      which will eventually allow libc.a and libc.so to be produced from the
      same object files.
      
      the original motivation for these #ifdefs which are now being removed
      was to allow building a static-only libc using a compiler that does
      not support visibility. however, SHARED was the wrong condition to
      test for this anyway; various assembly-language sources refer to
      hidden symbols and declare them with the .hidden directive, making it
      wrong to define the referenced symbols as non-hidden. if there is a
      need in the future to build libc using compilers that lack visibility,
      support could be moved to the build system or perhaps the __PIC__
      macro could be checked instead of SHARED.
      8a8fdf63
  33. 10 11月, 2015 1 次提交
    • R
      explicitly assemble all arm asm sources as UAL · 4e73d121
      Rich Felker 提交于
      these files are all accepted as legacy arm syntax when producing arm
      code, but legacy syntax cannot be used for producing thumb2 with
      access to the full ISA. even after switching to UAL, some asm source
      files contain instructions which are not valid in thumb mode, so these
      will need to be addressed separately.
      4e73d121
  34. 24 9月, 2015 1 次提交
    • R
      fix signal return for sh/fdpic · b61df229
      Rich Felker 提交于
      the restorer function pointer provided in the kernel sigaction
      structure is interpreted by the kernel as a raw code address, not a
      function descriptor.
      
      this commit moves the declarations of the __restore and __restore_rt
      symbols to ksigaction.h so that arch versions of the file can override
      them, and introduces a version for sh which declares them as objects
      rather than functions.
      
      an alternate solution would have been defining SA_RESTORER to 0 so
      that the functions are not used, but this both requires executable
      stack (since the sh kernel does not have a vdso page with permanent
      restorer functions) and crashes on qemu user-level emulation.
      b61df229
  35. 09 9月, 2015 1 次提交
    • R
      remove unused (and invalid) C version of sigsetjmp · deb85ab4
      Rich Felker 提交于
      originally, the comment in this code was correct and it would likely
      work if the compiler generated a tail call to setjmp. however, commit
      583e5512 redesigned sigsetjmp and
      siglongjmp such that the old C implementation (which was not intended
      to be used) is not even conceptually correct. remove it in the
      interest of avoiding confusion when porting to new archs.
      deb85ab4
  36. 16 6月, 2015 1 次提交
    • R
      switch to using trap number 31 for syscalls on sh · 10d0268c
      Rich Felker 提交于
      nominally the low bits of the trap number on sh are the number of
      syscall arguments, but they have never been used by the kernel, and
      some code making syscalls does not even know the number of arguments
      and needs to pass an arbitrary high number anyway.
      
      sh3/sh4 traditionally used the trap range 16-31 for syscalls, but part
      of this range overlapped with hardware exceptions/interrupts on sh2
      hardware, so an incompatible range 32-47 was chosen for sh2.
      
      using trap number 31 everywhere, since it's in the existing sh3/sh4
      range and does not conflict with sh2 hardware, is a proposed
      unification of the kernel syscall convention that will allow binaries
      to be shared between sh2 and sh3/sh4. if this is not accepted into the
      kernel, we can refit the sh2 target with runtime selection mechanisms
      for the trap number, but doing so would be invasive and would entail
      non-trivial overhead.
      10d0268c