1. 13 9月, 2018 12 次提交
  2. 06 9月, 2018 2 次提交
  3. 05 9月, 2018 6 次提交
  4. 03 9月, 2018 1 次提交
  5. 02 9月, 2018 1 次提交
  6. 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
  7. 30 8月, 2018 7 次提交
    • R
      prevent perror from clobbering stderr's orientation · cff4b910
      Rich Felker 提交于
      this requirement is specified by POSIX.
      cff4b910
    • 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
    • R
      make vfprintf set stream orientation even for zero-length output · a43a7b21
      Rich Felker 提交于
      if no output is produced, no underlying fwrite will ever be called,
      but byte-oriented printf functions are still required to set the
      orientation of the stream to byte-oriented. call __towrite explicitly
      if the FILE is not already in write mode.
      a43a7b21
    • R
      re-fix vfprintf temporary buffer logic · f1791f42
      Rich Felker 提交于
      commit b5a8b289 setup the write buffer
      bound pointers for the temporary buffer manually to fix a buffer
      overflow issue, but in doing so, caused vfprintf on unbuffered files
      never to call __towrite, thereby failing to set the stream orientation
      to byte-oriented, failing to clear any prior read mode, and failing to
      produce an error when the stream is not writable.
      
      revert the inline setup of the bounds pointers and instead zero them,
      so that the underlying fwrite code will call __towrite to set them up.
      f1791f42
    • R
      fix missing flush of stderr at exit if it was put in buffered mode · ddc947ed
      Rich Felker 提交于
      commit 0b80a7b0 added the ability to
      set application-provided stdio FILE buffers, adding the possibility
      that stderr might be buffered at exit time, but __stdio_exit did not
      have code to flush it.
      
      this regression was not present in any release.
      ddc947ed
    • R
      fix async thread cancellation on sh-fdpic · 35cd7c09
      Rich Felker 提交于
      if __cp_cancel was reached via __syscall_cp, r12 will necessarily
      still contain a GOT pointer (for libc.so or for the static-linked main
      program) valid for entering __cancel. however, in the case of async
      cancellation, r12 may contain any scratch value; it's not necessarily
      even a valid GOT pointer for the code that was interrupted.
      
      unlike in commit 0ec49dab where the
      corresponding issue was fixed for powerpc64, there is fundamentally no
      way for fdpic code to recompute its GOT pointer. so a new mechanism is
      introduced for cancel_handler to write a GOT register value into the
      interrupted context on archs where it is needed.
      35cd7c09
    • R
      fix async thread cancellation on powerpc64 · 0ec49dab
      Rich Felker 提交于
      entering the local entry point for __cancel from __cp_cancel is valid
      if __cp_cancel was reached from __syscall_cp, since both are in libc
      and share the same TOC pointer, but it is not valid if __cp_cancel was
      reached when cancel_handler rewrote the program counter for
      asynchronous cancellation of code outside libc.
      
      to ensure __cancel is entered with a valid TOC pointer, recompute the
      correct value in a PC-relative manner before jumping.
      0ec49dab
  8. 29 8月, 2018 9 次提交
    • A
      vfwprintf: honor field width with 'c' format type · 9cdaf1a8
      A. Wilcox 提交于
      9cdaf1a8
    • R
      fix several values reported by sysconf · d41cdef9
      Rich Felker 提交于
      - REALTIME_SIGNALS is supposed to be version-valued
      - DELAYTIMER_MAX was wrongly using the min allowed max
      - unavailable compilation environments wrongly used 0 instead of -1
      d41cdef9
    • R
      fix return value of system on failure to spawn child process · 1d297a28
      Rich Felker 提交于
      the value 0x7f00 (as if by _exit(127)) is specified only for the case
      where the child is created but then fails to exec the shell, since
      traditional fork+exec implementations do not admit reporting an error
      via errno in this case without additional machinery. it's unclear
      whether an implementation not subject to this failure mode needs to
      emulate it; one could read the standard as requiring that. if so,
      additional code will need to be added to map posix_spawn errors into
      the form system is expected to return. but for now, returning -1 to
      indicate an error is significantly better behavior than always
      reporting failures as if the shell failed to exec after fork.
      1d297a28
    • R
      set stream orientations in open_[w]memstream · b152d575
      Rich Felker 提交于
      fundamentally there is no good reason these functions need to set an
      orientation (morally it should be possible to write a wchar_t[] memory
      stream using byte functions, or a char[] memory stream using wide
      functions), but it's a part of the specification that they do. aside
      from being able to inspect the orientation with fwide, failure to set
      the orientation in open_wmemstream is observable if the locale changes
      between open_wmemstream and the first operation on the stream; this is
      because the encoding rule (locale) for the stream is required to be
      bound at the time the stream becomes wide-oriented.
      
      for open_wmemstream, call fwide to avoid duplicating the logic for
      binding the encoding rule. for open_memstream it suffices just to set
      the mode field in the FILE struct.
      b152d575
    • R
      make fmemopen's w+ mode truncate the buffer · f66022dd
      Rich Felker 提交于
      the w+ mode is specified to "truncate the buffer contents". like most
      of fmemopen, exactly what this means is underspecified. mode w and w+
      of course implicitly 'truncate' the buffer if a write from the initial
      position is flushed, so in order for this part of the text about w+
      not to be spurious, it should be interpreted as requiring something
      else, and the obvious reasonable interpretation is that the truncation
      is immediately visible if you attempt to read from the stream or the
      buffer before writing/flushing.
      
      this interpretation agrees with reported conformance test failures.
      f66022dd
    • R
      set errno when fileno is called on a FILE with no underlying fd · b39b47ba
      Rich Felker 提交于
      this is a POSIX requirement.
      
      also remove the gratuitous locking shenanigans and simply access f->fd
      under control of the lock. there is no advantage to not doing so, and
      it made the correctness non-obvious at best.
      b39b47ba
    • R
      reject invalid arguments to pthread_barrierattr_setpshared · baf95a5a
      Rich Felker 提交于
      this is a POSIX requirement.
      baf95a5a
    • S
      rewrite __aeabi_read_tp in asm · 056f9d81
      Szabolcs Nagy 提交于
      __aeabi_read_tp used to call c code, but that was incorrect as the
      arm runtime abi specifies special pcs for this function: it is only
      allowed to clobber r0, ip, lr and cpsr.
      
      maintainer's note: the old code explicitly saved and restored all
      general-purpose registers which are call-clobbered in the normal
      calling convention, so it's unlikely that any real-world compilers
      produced code that could break. however theoretically they could have
      chosen to use floating point registers, in which case the caller's
      values of those registers would be clobbered.
      056f9d81
    • R
      fix dubious char signedness check in limits.h · cdbbcfb8
      Rich Felker 提交于
      commit 201995f3 introduced a hack
      utilizing the signedness of character constants at the preprocessor
      level to avoid depending on the gcc-specific __CHAR_UNSIGNED__ predef.
      while this trick works on gcc and presumably other compilers being
      used, it's not clear that the behavior it depends on is actually
      conforming. C11 6.4.4.4 ¶10 defines character constants as having type
      int, and 6.10.1 ¶4 defines preprocessor #if arithmetic to take place
      in intmax_t or uintmax_t, depending on the signedness of the integer
      operand types, and it is specified that "this includes interpreting
      character constants".
      
      if character literals had type char and just promoted to int, it would
      be clear that when char is unsigned they should behave as uintmax_t at
      the preprocessor level. however, as written the text of the standard
      seems to require that character constants always behave as intmax_t,
      corresponding to int, at the preprocessor level.
      
      since there is a good deal of ambiguity about the correct behavior and
      a risk that compilers will disagree or that an interpretation may
      mandate a change in the behavior, do not rely on it for defining
      CHAR_MIN and CHAR_MAX correctly. instead, use the signedness of the
      value (as opposed to the type) of '\xff', which will be positive if
      and only if plain char is unsigned. this behavior is clearly
      specified, and the specific case '\xff' is even used in an example,
      under 6.4.4.4 of the standard.
      cdbbcfb8