1. 11 7月, 2019 2 次提交
  2. 10 7月, 2019 2 次提交
  3. 09 7月, 2019 1 次提交
    • R
      prevent dup2 action for posix_spawn internal pipe fd · 75990040
      Rich Felker 提交于
      as reported by Tavian Barnes, a dup2 file action for the internal pipe
      fd used by posix_spawn could cause it to remain open after execve and
      allow the child to write an artificial error into it, confusing the
      parent. POSIX allows internal use of file descriptors by the
      implementation, with undefined behavior for poking at them, so this is
      not a conformance problem, but it seems preferable to diagnose and
      prevent the error when we can do so easily.
      
      catch attempts to apply a dup2 action to the internal pipe fd and
      emulate EBADF for it instead.
      75990040
  4. 07 7月, 2019 1 次提交
    • R
      fix inadvertent use of uninitialized variable in dladdr · 9b831820
      Rich Felker 提交于
      commit c8b49b2f introduced code that
      checked bestsym to determine whether a matching symbol was found, but
      bestsym is uninitialized if not. instead use best, consistent with use
      in the rest of the function.
      
      simplified from bug report and patch by Cheng Liu.
      9b831820
  5. 05 7月, 2019 2 次提交
  6. 03 7月, 2019 1 次提交
  7. 02 7月, 2019 11 次提交
    • S
      add new syscall numbers from linux v5.1 · f3f96f2d
      Szabolcs Nagy 提交于
      syscall numbers are now synced up across targets (starting from 403 the
      numbers are the same on all targets other than an arch specific offset)
      
      IPC syscalls sem*, shm*, msg* got added where they were missing (except
      for semop: only semtimedop got added), the new semctl, shmctl, msgctl
      imply IPC_64, see
      
        linux commit 0d6040d4681735dfc47565de288525de405a5c99
        arch: add split IPC system calls where needed
      
      new 64bit time_t syscall variants got added on 32bit targets, see
      
        linux commit 48166e6ea47d23984f0b481ca199250e1ce0730a
        y2038: add 64-bit time_t syscalls to all 32-bit architectures
      
      new async io syscalls got added, see
      
        linux commit 2b188cc1bb857a9d4701ae59aa7768b5124e262e
        Add io_uring IO interface
      
        linux commit edafccee56ff31678a091ddb7219aba9b28bc3cb
        io_uring: add support for pre-mapped user IO buffers
      
      a new syscall got added that uses the fd of /proc/<pid> as a stable
      handle for processes: allows sending signals without pid reuse issues,
      intended to eventually replace rt_sigqueueinfo, kill, tgkill and
      rt_tgsigqueueinfo, see
      
        linux commit 3eb39f47934f9d5a3027fe00d906a45fe3a15fad
        signal: add pidfd_send_signal() syscall
      
      on some targets (arm, m68k, s390x, sh) some previously missing syscall
      numbers got added as well.
      f3f96f2d
    • S
      ipc: prefer SYS_ipc when it is defined · 4acfc287
      Szabolcs Nagy 提交于
      Linux v5.1 introduced ipc syscalls on targets where previously only
      SYS_ipc was available, change the logic such that the ipc code keeps
      using SYS_ipc which works backward compatibly on older kernels.
      
      This changes behaviour on microblaze which had both mechanisms, now
      SYS_ipc will be used instead of separate syscalls.
      4acfc287
    • S
      mips64: fix syscall numbers of io_pgetevents and rseq · b574de5b
      Szabolcs Nagy 提交于
      the numbers added in
      
        commit d149e69c
        add io_pgetevents and rseq syscall numbers from linux v4.18
      
      were incorrect.
      b574de5b
    • S
      elf.h: add NT_ARM_PAC{A,G}_KEYS from linux v5.1 · 47bc7f0a
      Szabolcs Nagy 提交于
      to request or change pointer auth keys for criu via ptrace, new in
      
        linux commit d0a060be573bfbf8753a15dca35497db5e968bb0
        arm64: add ptrace regsets for ptrauth key management
      47bc7f0a
    • S
      netinet/in.h: add INADDR_ALLSNOOPERS_GROUP from linux v5.1 · eea841e6
      Szabolcs Nagy 提交于
      RFC 4286: "The IPv4 multicast address for All-Snoopers is 224.0.0.106."
      from
      
        linux commit 4effd28c1245303dce7fd290c501ac2c11052114
        bridge: join all-snoopers multicast address
      eea841e6
    • S
      sys/socket.h: add SO_BINDTOIFINDEX from linux v5.1 · 5b2b682d
      Szabolcs Nagy 提交于
      SO_BINDTOIFINDEX behaves similar to SO_BINDTODEVICE, but takes a
      network interface index as argument, rather than the network
      interface name. see
      
        linux commit f5dd3d0c9638a9d9a02b5964c4ad636f06cf7e2c
        net: introduce SO_BINDTOIFINDEX sockopt
      5b2b682d
    • S
      s390x: drop SO_ definitions from bits/socket.h · 45235051
      Szabolcs Nagy 提交于
      the s390x definitions matched the generic ones in sys/socket.h.
      45235051
    • S
      netinet/in.h: add IPV6_ROUTER_ALERT_ISOLATE from linux v5.1 · 93b5f6c8
      Szabolcs Nagy 提交于
      restricts router alert packets received by the socket to the
      socket's namespace only. see
      
        linux commit 9036b2fe092a107856edd1a3bad48b83f2b45000
        net: ipv6: add socket option IPV6_ROUTER_ALERT_ISOLATE
      93b5f6c8
    • S
      sys/prctl.h: add PR_SPEC_DISABLE_NOEXEC from linux v5.1 · c7081edc
      Szabolcs Nagy 提交于
      allows specifying that the speculative store bypass disable bit should
      be cleared on exec. see
      
        linux commit 71368af9027f18fe5d1c6f372cfdff7e4bde8b48
        x86/speculation: Add PR_SPEC_DISABLE_NOEXEC
      c7081edc
    • S
      fcntl.h: add F_SEAL_FUTURE_WRITE from linux v5.1 · 9e8dd1c7
      Szabolcs Nagy 提交于
      needed for android so it can migrate from its ashmem to memfd.
      allows making the memfd readonly for future users while keeping
      a writable mmap of it. see
      
        linux commit ab3948f58ff841e51feb845720624665ef5b7ef3
        mm/memfd: add an F_SEAL_FUTURE_WRITE seal to memfd
      9e8dd1c7
    • S
      sys/fanotify.h: update for linux v5.1 · f67b3c17
      Szabolcs Nagy 提交于
      includes changes from linux v5.1
      
        linux commit 235328d1fa4251c6dcb32351219bb553a58838d2
        fanotify: add support for create/attrib/move/delete events
      
        linux commit 5e469c830fdb5a1ebaa69b375b87f583326fd296
        fanotify: copy event fid info to user
      
        linux commit e9e0c8903009477b630e37a8b6364b26a00720da
        fanotify: encode file identifier for FAN_REPORT_FID
      
      as well as earlier changes that were missed.
      
      sys/statfs.h is included for fsid_t.
      f67b3c17
  8. 01 7月, 2019 1 次提交
    • S
      fix deadlock in synccall after threaded fork · 84ebec6c
      Samuel Holland 提交于
      synccall may be called by AS-safe functions such as setuid/setgid after
      fork. although fork() resets libc.threads_minus_one, causing synccall to
      take the single-threaded path, synccall still takes the thread list
      lock. This lock may be held by another thread if for example fork()
      races with pthread_create(). After fork(), the value of the lock is
      meaningless, so clear it.
      
      maintainer's note: commit 8f11e612 and
      e4235d70 introduced this regression.
      the state protected by this lock is the linked list, which is entirely
      replaced in the child path of fork (next=prev=self), so resetting it
      is semantically sound.
      84ebec6c
  9. 29 6月, 2019 1 次提交
    • R
      cap getdents length argument to INT_MAX · 3d178a7e
      Rich Felker 提交于
      the linux syscall treats this argument as having type int, so passing
      extremely long buffer sizes would be misinterpreted by the kernel.
      since "short reads" are always acceptable, just cap it down.
      
      patch based on report and suggested change by Florian Weimer.
      3d178a7e
  10. 26 6月, 2019 2 次提交
    • R
      remove unnecessary and problematic _Noreturn from crt/ldso startup · 54b7564b
      Rich Felker 提交于
      after commit a48ccc15 removed the use
      of _Noreturn on the stage3_func type (which only worked due to it
      being defined to the "GNU C" attribute in C99 mode), GCC could no
      longer assume that the ends of __dls2 and __dls2b are unreachable, and
      produced a warning that a function marked _Noreturn returns.
      
      also, since commit 4390383b, the
      _Noreturn declaration for __libc_start_main in crt1/rcrt1 has been not
      only inconsistent with the definition, but wrong. formally,
      __libc_start_main does return, via a (hopefully) tail call to a helper
      function after the barrier. incorrect usage of _Noreturn in the
      declaration was probably formal UB.
      
      the _Noreturn specifiers were not useful in any of these places, so
      remove them all. now, the only remaining usage of _Noreturn is in
      public interfaces where _Noreturn is part of their contract.
      54b7564b
    • R
      allow fmemopen with zero size · 95dfa3dd
      Rich Felker 提交于
      previously, POSIX erroneously required this to fail with EINVAL
      despite the traditional glibc implementation, on which the POSIX
      interface was based, allowing it. the resolution of Austin Group issue
      818 removes the requirement to fail.
      95dfa3dd
  11. 22 6月, 2019 2 次提交
    • M
      do not use _Noreturn for a function pointer in dynamic linker · a48ccc15
      Matthew Maurer 提交于
      _Noreturn is a C11 construct, and may only be used at the site of a
      function definition.
      a48ccc15
    • R
      remove implicit include of sys/sysmacros.h from sys/types.h · a31a30a0
      Rich Felker 提交于
      this reverts commit f552c792, which
      exposed the sysmacros.h macros (device major/minor calculations) for
      BSD and GNU profiles to mimic an unintentional glibc behavior some
      code depended on. glibc has deprecated and since removed them as the
      resolution to bug #19239, so it makes no sense for us to keep this
      behavior. affected code should all have been fixed by now, and if it's
      not yet fixed it needs to be for use with modern glibc anyway.
      a31a30a0
  12. 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
  13. 27 5月, 2019 1 次提交
    • R
      optimize aarch64 dynamic tlsdesc function to spill fewer registers · 5fc43798
      Rich Felker 提交于
      with the glibc generation counter model for reusing dynamic tls slots
      after dlclose, it's really not possible to get away with fewer than 4
      working registers. for us however it's always been possible, but
      tricky, and only became apparent after the switch to installing new
      dynamic tls at dlopen time. by merging the negated thread pointer into
      the addend early, the register holding the thread pointer can
      immediately be reused, bringing the working register count down to
      three. this allows saving/restoring via a single stp/ldp pair, since
      the return register x0 does not need to be saved.
      
      net reduction of 3 instructions, 2 of which were push/pop.
      5fc43798
  14. 23 5月, 2019 2 次提交
    • R
      make powerpc64 vrregset_t logical layout match expected API · ac304227
      Rich Felker 提交于
      between v2 and v3 of the powerpc64 port patch, the change was made
      from a 32x4 array of 32-bit unsigned ints for vrregs[] to a 32-element
      array of __int128. this mismatches the API applications working with
      mcontext_t expect from glibc, and seems to have been motivated by a
      misinterpretation of a comment on how aarch64 did things as a
      suggestion to do the same on powerpc64.
      ac304227
    • R
      fix vrregset_t layout and member naming on powerpc64 · 3c59a868
      Rich Felker 提交于
      the mistaken layout seems to have been adapted from 32-bit powerpc,
      where vscr and vrsave are packed into the same 128-bit slot in a way
      that looks like it relies on non-overlapping-ness of the value bits in
      big endian.
      
      the powerpc64 port accounted for the fact that the 64-bit ABI puts
      each in its own 128-bit slot, but ordered them incorrectly (matching
      the bit order used on the 32-bit ABI), and failed to account for vscr
      being padded according to endianness so that it can be accessed via
      vector moves.
      
      in addition to ABI layout, our definition used different logical
      member layout/naming from glibc, where vscr is a structure to
      facilitate access as a 32-bit word or a 128-bit vector. the
      inconsistency here was unintentional, so fix it.
      3c59a868
  15. 17 5月, 2019 3 次提交
    • S
      fix tls offsets when p_vaddr%p_align != 0 on TLS_ABOVE_TP targets · a60b9e06
      Szabolcs Nagy 提交于
      currently the bfd linker does not seem to create tls segments where
      p_vaddr%p_align != 0, but this is valid in ELF and then the runtime
      computed tls offset must satisfy
      
        offset%p_align == (base+p_vaddr)%p_align
      
      and in case of local exec tls (main executable) the smallest such
      offset must be used (otherwise it is incompatible with the offset
      computed by the static linker). the !TLS_ABOVE_TP case is handled
      correctly (the offset is negative then in the formula).
      
      the ldso code for TLS_ABOVE_TP is changed so the static tls offset
      of each module satisfies the formula.
      a60b9e06
    • S
      fix static tls offsets of shared libs on TLS_ABOVE_TP targets · 6104dae9
      Szabolcs Nagy 提交于
      tls_offset should always point to the end of the allocated static tls
      area, but this was not handled correctly on "tls variant 1" targets
      in the dynamic linker:
      
      after application tls was allocated, tls_offset was aligned up,
      potentially wasting tls space. (alignment may be needed at the
      begining of the tls area, not at the end, but that will be fixed
      separately as it is unlikely to affect real binaries.)
      
      when static tls was allocated for a shared library, tls_offset was
      only updated with the size of the tls segment which does not include
      alignment gaps, which can easily happen if the tls size update for
      one library leaves tls_offset misaligned for the next one. this can
      cause oob access in __copy_tls or arbitrary breakage at tls access.
      (the issue was observed on aarch64 with rust binaries)
      6104dae9
    • R
      fix format strings for uid/gid values in putpwent/putgrent · 9fd98a63
      Rich Felker 提交于
      commit 648c3b4e omitted this change,
      which is needed to be able to use uid/gid values greater than INT_MAX
      with these interfaces. it fixes alpine linux bug #10460.
      9fd98a63
  16. 12 5月, 2019 2 次提交
    • F
      remove unused struct dso members from dynlink.c · f450c150
      Fangrui Song 提交于
      maintainer's note: commit 9d44b646
      removed their use.
      f450c150
    • R
      improve i386 inline syscall asm on non-broken compilers · bdb08175
      Rich Felker 提交于
      we have to avoid using ebx unconditionally in asm constraints for
      i386, because gcc 3 and 4 and possibly other simplistic compilers
      (pcc?) implement PIC via making ebx a fixed-use register, and disallow
      its use for anything else. rather than hard-coding knowledge of which
      compilers work (at least gcc 5+ and clang), perform a configure test;
      this should give us the good codegen on any new compilers we don't yet
      know about.
      
      swapping ebx and edx is kept for 1- and 2-arg syscalls because it
      avoids having any spills/stack-frame at all in small functions. for
      6-arg, if ebx is directly usable, the complex shuffling introduced in
      commit c8798ef9 can be avoided, and
      ebp can be loaded the same way ebx is in 5-arg syscalls for compilers
      that don't support direct use of ebx.
      bdb08175
  17. 11 5月, 2019 1 次提交
    • R
      fix regression in i386 inline syscall asm producing invalid code · c8798ef9
      Rich Felker 提交于
      commit 22e5bbd0 inlined the i386
      syscall mechanism, but wrongly assumed memory operands to the 5- and
      6-argument syscall asm would be esp-based. however, nothing in the
      constraints prevented them from being ebx- or ebp-based, and in those
      cases, ebx and ebp could be clobbered before use of the memory operand
      was complete. in the 6-argument case, this prevented restoration of
      the original register values before the end of the asm block, breaking
      the asm contract since ebx and ebp are not marked as clobbered. (they
      can't be, because lots of compilers don't accept these registers in
      constraints or clobbers if PIC or frame pointer is enabled).
      
      doing this right is complicated by the fact that, after a single push,
      no operands which might be memory operands are usable. if they are
      esp-based, the value of esp has changed, rendering them invalid.
      
      introduce some new dances to load the registers. for the 5-arg case,
      push the operand that may be a memory operand first, and after that,
      it doesn't matter if the operand is invalid, since we'll just use the
      newly pushed value. for the 6-arg case, we need to put both operands
      in memory to begin with, like the old non-inline code prior to commit
      22e5bbd0 accepted, so that there's
      only one potentially memory-based operand to the asm. this can then be
      saved with a single push, and after that the values can be read off
      into the registers they're needed in.
      
      there's some size overhead, but still a lot less execution overhead
      than the old out-of-line code. doing it better depends on a modern
      compiler that lets you use ebx and ebp in asm constraints without
      restriction. the failure modes on compilers where this doesn't work
      are inconsistent and dangerous (on at least some gcc versions 4.x and
      earlier, wrong codegen!), so this is a delicate matter. it can be
      addressed later if needed.
      c8798ef9
  18. 06 5月, 2019 1 次提交
    • R
      make fgetwc set error indicator for stream on encoding errors · 511d7073
      Rich Felker 提交于
      this is a requirement in POSIX that's omitted, and seemed potentially
      non-conforming, in the C standard. as such it was omitted here.
      however, as part of Austin Group issue #1170, the discrepancy was
      raised with WG14 and determined to be unintended; future versions of
      the C standard will require the error indicator to be set, as POSIX
      does.
      511d7073
  19. 05 5月, 2019 3 次提交