Commit Graph

140 Commits

Author SHA1 Message Date
Rich Felker 2c124e13bd stdint.h: derive limits from __LONG_MAX, use common fast16 types
the bits file is retained, but as a single generic version, to allow
for the unlikely future possibility of letting a new arch define
something differently.
2024-05-07 09:17:51 -04:00
Rich Felker e709a6f07a sys/reg.h: derive __WORDSIZE from __LONG_MAX
this removes an otherwise-unnecessary bits header from most archs,
replacing it with an empty generic version.
2024-05-07 09:08:31 -04:00
Rich Felker 29b216b2f2 unistd.h: derive ILP32/LP64 macros from __LONG_MAX instead of arch bits 2024-05-07 09:01:47 -04:00
Gaël PORTAY 3d5c9fe39f bits/syscall.h: add __NR_fchmodat2 from linux v6.6
the linux fchmodat syscall lacks a flag argument that is necessary to
implement the posix api, see

  linux commit 09da082b07bbae1c11d9560c8502800039aebcea
  fs: Add fchmodat2()

  linux commit 78252deb023cf0879256fcfbafe37022c390762b
  arch: Register fchmodat2, usually as syscall 452
2024-02-22 19:24:18 -05:00
Gaël PORTAY dd690c4909 bits/syscall.h: add cachestat from linux v6.4
see

    linux commit cf264e1329fb0307e044f7675849f9f38b44c11a
    cachestat: implement cachestat syscall

    linux commit 946e697c69ffeeefdd84dad90eac307284df46be
    cachestat: wire up cachestat for other architectures
2024-02-22 19:23:47 -05:00
Gaël PORTAY 33e8c469a9 bits/syscall.h: add set_mempolicy_home_node from linux v5.17
see

    linux commit c6018b4b254971863bd0ad36bb5e7d0fa0f0ddb0
    mm/mempolicy: add set_mempolicy_home_node syscall

    linux commit 21b084fdf2a49ca1634e8e360e9ab6f9ff0dee11
    mm/mempolicy: wire up syscall set_mempolicy_home_node
2024-02-22 19:23:37 -05:00
Gaël PORTAY b2c4c3d590 bits/syscall.h: add futex_waitv from linux v5.16
see

    linux commit 039c0ec9bb77446d7ada7f55f90af9299b28ca49
    futex,x86: Wire up sys_futex_waitv()

    linux commit ea7c45fde5aa3e761aaddb7902a31a95cb120e7b
    futex,arm: Wire up sys_futex_waitv()

    linux commit b3ff2881ba18b852f79f5476d7631940071f1adb
    MIPS: syscalls: Wire up futex_waitv syscall

    linux commit 6c122360cf2f4c5a856fcbd79b4485b7baec942a
    s390: wire up sys_futex_waitv system call

    linux commit a0eb2da92b715d0c97b96b09979689ea09faefe6
    futex: Wireup futex_waitv syscall
2024-02-22 19:23:13 -05:00
Rich Felker e975127947 bits/syscall.h: add process_mrelease from linux v5.15
see

    linux commit 884a7e5964e06ed93c7771c0d7cf19c09a8946f1
    mm: introduce process_mrelease system call

    linux commit dce49103962840dd61423d7627748d6c558d58c5
    mm: wire up syscall process_mrelease
2024-02-22 19:23:05 -05:00
Rich Felker 269d193820 fix wrong sigaction syscall ABI on mips*, or1k, microblaze, riscv64
we wrongly defined a dummy SA_RESTORER flag on these archs, despite
the kernel interface not actually having such a feature. on archs
which lack SA_RESTORER, the kernel sigaction structure also lacks the
restorer function pointer member, which means the signal mask appears
at a different offset. the kernel was thereby interpreting the bits of
the code address as part of the signal set to be masked while handling
the signal.

this patch removes the erroneous SA_RESTORER definitions from archs
which do not have it, makes access to the member conditional on
whether SA_RESTORER is defined for the arch, and removes the
now-unused asm for the affected archs.

because there are reportedly versions of qemu-user which also use the
wrong ABI here, the old ksigaction struct size is preserved with an
unused member at the end. this is harmless and mitigates the risk of
such a bug turning into a buffer overflow onto the sigaction
function's stack.
2023-02-09 12:33:35 -05:00
Szabolcs Nagy ee05b11b67 bits/syscall.h: add landlock syscalls from linux v5.13
see

  linux commit a49f4f81cb48925e8d7cbd9e59068f516e984144
  arch: Wire up Landlock syscalls

  linuxcommit 17ae69aba89dbfa2139b7f8024b757ab3cc42f59
  Merge tag 'landlock_v34' of ... jmorris/linux-security

Landlock provides for unprivileged application sandboxing. The goal of
Landlock is to enable to restrict ambient rights (e.g. global filesystem
access) for a set of processes. Landlock is inspired by seccomp-bpf but
instead of filtering syscalls and their raw arguments, a Landlock rule
can restrict the use of kernel objects like file hierarchies, according
to the kernel semantic.
2022-03-08 17:21:14 -05:00
Szabolcs Nagy f7d3db5bfc bits/syscall.h: add mount_setattr from linux v5.12
new syscall to change the properties of a mount or a mount tree using
file descriptors which the new mount api is based on, see

  linux commit 2a1867219c7b27f928e2545782b86daaf9ad50bd
  fs: add mount_setattr()
2022-03-08 17:19:51 -05:00
Szabolcs Nagy b21f3ded78 bits/syscall.h: add epoll_pwait2 from linux v5.11
see

  linux commit b0a0c2615f6f199a656ed8549d7dce625d77aa77
  epoll: wire up syscall epoll_pwait2

  linux commit 58169a52ebc9a733aeb5bea857bc5daa71a301bb
  epoll: add syscall epoll_pwait2

epoll_wait with struct timespec timeout instead of int. no time32 variant.
2022-03-08 17:19:36 -05:00
Szabolcs Nagy fd285f9dec bits/syscall.h: add process_madvise from linux v5.10
mainly added to linux to allow a central process management service in
android to give MADV_COLD|PAGEOUT hints for other processes, see

  linux commit ecb8ac8b1f146915aa6b96449b66dd48984caacc
  mm/madvise: introduce process_madvise() syscall: an external memory
  hinting API
2021-02-15 09:15:54 -05:00
Szabolcs Nagy 3ba370fe8d bits/syscall.h: add __NR_close_range from linux v5.9
see

  linux commit 9b4feb630e8e9801603f3cab3a36369e3c1cf88d
  arch: wire-up close_range()

  linux commit 278a5fbaed89dacd04e9d052f4594ffd0e0585de
  open: add close_range()
2020-11-29 00:54:14 -05:00
Szabolcs Nagy 9b7ed9702c bits/syscall.h: add __NR_faccessat2 from linux v5.8
the linux faccessat syscall lacks a flag argument that is necessary
to implement the posix api, see

  linux commit c8ffd8bcdd28296a198f237cc595148a8d4adfbe
  vfs: add faccessat2 syscall
2020-09-09 17:21:03 -04:00
Szabolcs Nagy d990090384 add pidfd_getfd and openat2 syscall numbers from linux v5.6
also added clone3 on sh and m68k, on sh it's still missing (not
yet wired up), but reserved so safe to add.

see

  linux commit fddb5d430ad9fa91b49b1d34d0202ffe2fa0e179
  open: introduce openat2(2) syscall

  linux commit 9a2cef09c801de54feecd912303ace5c27237f12
  arch: wire up pidfd_getfd syscall

  linux commit 8649c322f75c96e7ced2fec201e123b2b073bf09
  pid: Implement pidfd_getfd syscall

  linux commit e8bb2a2a1d51511e6b3f7e08125d52ec73c11139
  m68k: Wire up clone3() syscall
2020-09-09 17:19:55 -04:00
Rich Felker 3a5b9ae7cf deduplicate __pthread_self thread pointer adjustment out of each arch
the adjustment made is entirely a function of TLS_ABOVE_TP and
TP_OFFSET. aside from avoiding repetition of the TP_OFFSET value and
arithmetic, this change makes pthread_arch.h independent of the
definition of struct __pthread from pthread_impl.h. this in turn will
allow inclusion of pthread_arch.h to be moved to the top of
pthread_impl.h so that it can influence the definition of the
structure.

previously, arch files were very inconsistent about the type used for
the thread pointer. this change unifies the new __get_tp interface to
always use uintptr_t, which is the most correct when performing
arithmetic that may involve addresses outside the actual pointed-to
object (due to TP_OFFSET).
2020-08-27 18:36:45 -04:00
Rich Felker ea71a9004e deduplicate TP_ADJ logic out of each arch, replace with TP_OFFSET
the only part of TP_ADJ that was not uniquely determined by
TLS_ABOVE_TP was the 0x7000 adjustment used mainly on mips and powerpc
variants.
2020-08-24 22:04:52 -04:00
Rich Felker c2feda4e2e prefer new socket syscalls, fallback to SYS_socketcall only if needed
a number of users performing seccomp filtering have requested use of
the new individual syscall numbers for socket syscalls, rather than
the legacy multiplexed socketcall, since the latter has the arguments
all in memory where they can't participate in filter decisions.

previously, some archs used the multiplexed socketcall if it was
historically all that was available, while other archs used the
separate syscalls. the intent was that the latter set only include
archs that have "always" had separate socket syscalls, at least going
back to linux 2.6.0. however, at least powerpc, powerpc64, and sh were
wrongly included in this set, and thus socket operations completely
failed on old kernels for these archs.

with the changes made here, the separate syscalls are always
preferred, but fallback code is compiled for archs that also define
SYS_socketcall. two such archs, mips (plain o32) and microblaze,
define SYS_socketcall despite never having needed it, so it's now
undefined by their versions of syscall_arch.h to prevent inclusion of
useless fallback code.

some archs, where the separate syscalls were only added after the
addition of SYS_accept4, lack SYS_accept. because socket calls are
always made with zeros in the unused argument positions, it suffices
to just use SYS_accept4 to provide a definition of SYS_accept, and
this is done to make happy the macro machinery that concatenates the
socket call name onto __SC_ and SYS_.
2020-08-08 20:59:26 -04:00
Rich Felker b4712ba445 remove legacy time32 timer[fd] syscalls from public syscall.h
this extends commit 5a105f19b5, removing
timer[fd]_settime and timer[fd]_gettime. the timerfd ones are likely
to have been used in software that started using them before it could
rely on libc exposing functions.
2020-02-05 09:57:41 -05:00
Rich Felker 2cae9f59da remove further legacy time32 clock syscalls from public syscall.h
this extends commit 5a105f19b5, removing
clock_settime, clock_getres, clock_nanosleep, and settimeofday.
2020-02-05 09:51:09 -05:00
Rich Felker 5a105f19b5 remove legacy clock_gettime and gettimeofday from public syscall.h
some nontrivial number of applications have historically performed
direct syscalls for these operations rather than using the public
functions. such usage is invalid now that time_t is 64-bit and these
syscalls no longer match the types they are used with, and it was
already harmful before (by suppressing use of vdso).

since syscall() has no type safety, incorrect usage of these syscalls
can't be caught at compile-time. so, without manually inspecting or
running additional tools to check sources, the risk of such errors
slipping through is high.

this patch renames the syscalls on 32-bit archs to clock_gettime32 and
gettimeofday_time32, so that applications using the original names
will fail to build without being fixed.

note that there are a number of other syscalls that may also be unsafe
to use directly after the time64 switchover, but (1) these are the
main two that seem to be in widespread use, and (2) most of the others
continue to have valid usage with a null timeval/timespec argument, as
the argument is an optional timeout or similar.
2020-01-30 11:25:07 -05:00
Szabolcs Nagy fa765ca54f add clone3 syscall number from linux v5.3
the syscall number is reserved on all targets, but it is not wired up
on all targets, see

  linux commit 8f6ccf6159aed1f04c6d179f61f6fb2691261e84
  Merge tag 'clone3-v5.3' of ... brauner/linux

  linux commit 8f3220a806545442f6f26195bc491520f5276e7c
  arch: wire-up clone3() syscall

  linux commit 7f192e3cd316ba58c88dfa26796cf77789dd9872
  fork: add clone3
2019-12-30 18:13:56 -05:00
Szabolcs Nagy a45289112c add pidfd_open syscall number from linux v5.3
see

  linux commit 7615d9e1780e26e0178c93c55b73309a5dc093d7
  arch: wire-up pidfd_open()

  linux commit 32fcb426ec001cb6d5a4a195091a8486ea77e2df
  pid: add pidfd_open()
2019-12-30 18:12:53 -05:00
Rich Felker d6dcfe4d0c move time_t and suseconds_t definitions to common alltypes.h.in
now that all 32-bit archs have 64-bit time_t (and suseconds_t), the
arch-provided _Int64 macro (long or long long, as appropriate) can be
used to define them, and arch-specific definitions are no longer
needed.
2019-11-02 18:30:56 -04:00
Rich Felker b60fdf133c move time64 ioctl numbers to generic bits/ioctl.h
now that all 32-bit archs have 64-bit time types, the values for the
time-related ioctls can be shared. the mechanism for this is an
arch/generic version of the bits header. archs which don't use the
generic header still need to duplicate the definitions.

x32, which does not use the new time64 values of the macros, already
has its own overrides, so this commit does not affect it.
2019-11-02 18:30:56 -04:00
Rich Felker c71dbb24c9 move time64 socket options from arch bits to top-level sys/socket.h
now that all 32-bit archs have 64-bit time types, the values for the
time-related socket option macros can be treated as universal for
32-bit archs. the sys/socket.h mechanism for this predates
arch/generic and is instead in the top-level header.

x32, which does not use the new time64 values of the macros, already
has its own overrides, so this commit does not affect it.
2019-11-02 18:30:56 -04:00
Rich Felker 3814333964 switch all existing 32-bit archs to 64-bit time_t
this commit preserves ABI fully for existing interface boundaries
between libc and libc consumers (applications or libraries), by
retaining existing symbol names for the legacy 32-bit interfaces and
redirecting sources compiled against the new headers to alternate
symbol names. this does not necessarily, however, preserve the
pairwise ABI of libc consumers with one another; where they use
time_t-derived types in their interfaces with one another, it may be
necessary to synchronize updates with each other.

the intent is that ABI resulting from this commit already be stable
and permanent, but it will not be officially so until a release is
made. changes to some header-defined types that do not play any role
in the ABI between libc and its consumers may still be subject to
change.

mechanically, the changes made by this commit for each 32-bit arch are
as follows:

- _REDIR_TIME64 is defined to activate the symbol redirections in
  public headers

- COMPAT_SRC_DIRS is defined in arch.mak to activate build of ABI
  compat shims to serve as definitions for the original symbol names

- time_t and suseconds_t definitions are changed to long long (64-bit)

- IPC_STAT definition is changed to add the IPC_TIME64 bit (0x100),
  triggering conversion of semid_ds, shmid_ds, and msqid_ds split
  low/high time bits into new time_t members

- structs semid_ds, shmid_ds, msqid_ds, and stat are modified to add
  new 64-bit time_t/timespec members at the end, maintaining existing
  layout of other members.

- socket options (SO_*) and ioctl (sockios) command macros are
  redefined to use the kernel's "_NEW" values.

in addition, on archs where vdso clock_gettime is used, the
VDSO_CGT_SYM macro definition in syscall_arch.h is changed to use a
new time64 vdso function if available, and a new VDSO_CGT32_SYM macro
is added for use as fallback on kernels lacking time64.
2019-11-02 18:30:56 -04:00
Rich Felker 2d3083e746 move pthread types out of per-arch alltypes.h
policy has long been that these definitions are purely a function of
whether long/pointer is 32- or 64-bit, and that they are not allowed
to vary per-arch. move the definition to the shared alltypes.h.in
fragment, using integer constant expressions in terms of sizeof to
vary the array dimensions appropriately. I'm not sure whether this is
more or less ugly than using preprocessor conditionals and two sets of
definitions here, but either way is a lot less ugly than repeating the
same thing for every arch.
2019-10-17 19:35:17 -04:00
Rich Felker 7cc79d10af define LONG_MAX via arch alltypes.h, strip down bits/limits.h
LLONG_MAX is uniform for all archs we support and plenty of header and
code level logic assumes it is, so it does not make sense for limits.h
bits mechanism to pretend it's variable.

LONG_BIT can be defined in terms of LONG_MAX; there's no reason to put
it in bits.

by moving LONG_MAX definition to __LONG_MAX in alltypes.h and moving
LLONG_MAX out of bits, there are now no plain-C limits that are
defined in the bits header, so the bits header only needs to be
included in the POSIX or extended profiles. this allows the feature
test macro logic to be removed from the bits header, facilitating a
long-term goal of getting such logic out of bits.

having __LONG_MAX in alltypes.h will allow further generalization of
headers.

archs without a constant PAGESIZE no longer need bits/limits.h at all.
2019-10-17 19:23:39 -04:00
Rich Felker 4d3a162d00 remove use of endian.h from arch reloc.h headers, clean up
building on commit 97d35a552e,
__BYTE_ORDER is now available wherever alltypes.h is included. since
reloc.h is only used from src/internal/dynlink.h, it can be assumed
that __BYTE_ORDER is exposed. reloc.h is not permitted to be included
in other contexts, and generally, like most arch headers, lacks
inclusion guards that would allow such usage. the mips64 version
mistakenly included such guards; they are removed for consistency.
2019-10-17 16:06:12 -04:00
Rich Felker 97d35a552e move __BYTE_ORDER definition to alltypes.h
this change is motivated by the intersection of several factors.
presently, despite being a nonstandard header, endian.h is exposing
the unprefixed byte order macros and functions only if _BSD_SOURCE or
_GNU_SOURCE is defined. this is to accommodate use of endian.h from
other headers, including bits headers, which need to define structure
layout in terms of endianness. with time64 switch-over, even more
headers will need to do this.

at the same time, the resolution of Austin Group issue 162 makes
endian.h a standard header for POSIX-future, requiring that it expose
the unprefixed macros and the functions even in standards-conforming
profiles. changes to meet this new requirement would break existing
internal usage of endian.h by causing it to violate namespace where
it's used.

instead, have the arch's alltypes.h define __BYTE_ORDER, either as a
fixed constant or depending on the right arch-specific predefined
macros for determining endianness. explicit literals 1234 and 4321 are
used instead of __LITTLE_ENDIAN and __BIG_ENDIAN so that there's no
danger of getting the wrong result if a macro is undefined and
implicitly evaluates to 0 at the preprocessor level.

the powerpc (32-bit) bits/endian.h being removed had logic for varying
endianness, but our powerpc arch has never supported that and has
always been big-endian-only. this logic is not carried over to the new
__BYTE_ORDER definition in alltypes.h.
2019-10-17 15:55:15 -04:00
Rich Felker 00ec11d19e remove per-arch definitions for va_list
now that commit f7f1079796 removed the
legacy i386 conditional definition, va_list is in no way
arch-specific, and has no reason to be in the future. move it to the
shared part of alltypes.h.in
2019-10-17 15:27:00 -04:00
Szabolcs Nagy b60763092e add new syscall numbers from linux v5.2
new mount api syscalls were added, same numers on all targets, see

  linux commit a07b20004793d8926f78d63eb5980559f7813404
  vfs: syscall: Add open_tree(2) to reference or clone a mount

  linux commit 2db154b3ea8e14b04fee23e3fdfd5e9d17fbc6ae
  vfs: syscall: Add move_mount(2) to move mounts around

  linux commit 24dcb3d90a1f67fe08c68a004af37df059d74005
  vfs: syscall: Add fsopen() to prepare for superblock creation

  linux commit ecdab150fddb42fe6a739335257949220033b782
  vfs: syscall: Add fsconfig() for configuring and managing a context

  linux commit 93766fbd2696c2c4453dd8e1070977e9cd4e6b6d
  vfs: syscall: Add fsmount() to create a mount for a superblock

  linux commit cf3cba4a429be43e5527a3f78859b1bfd9ebc5fb
  vfs: syscall: Add fspick() to select a superblock for reconfiguration

  linux commit 9c8ad7a2ff0bfe58f019ec0abc1fb965114dde7d
  uapi, x86: Fix the syscall numbering of the mount API syscalls [ver #2]

  linux commit d8076bdb56af5e5918376cd1573a6b0007fc1a89
  uapi: Wire up the mount API syscalls on non-x86 arches [ver #2]
2019-09-11 10:40:39 -04:00
Rich Felker 006a75a997 move IPC_STAT definition to a new bits/ipcstat.h file
otherwise, 32-bit archs that could otherwise share the generic
bits/ipc.h would need to duplicate the struct ipc_perm definition,
obscuring the fact that it's the same. sysvipc is not widely used and
these headers are not commonly included, so there is no performance
gain to be had by limiting the number of indirectly included files
here.

files with the existing time32 definition of IPC_STAT are added to all
current 32-bit archs now, so that when it's changed the change will
show up as a change rather than addition of a new file where it's less
obvious that the value is changing vs the generic one that was used
before.
2019-08-02 00:08:23 -04:00
Rich Felker 95ed26353c duplicate generic bits/msg.h for each arch using it, in prep to change 2019-07-29 18:22:33 -04:00
Rich Felker 6f2e5607d2 duplicate generic bits/sem.h for each arch using it, in prep to change 2019-07-29 18:07:23 -04:00
Rich Felker 7f797b5e25 remove trailing newlines from various versions of bits/shm.h 2019-07-29 15:54:38 -04:00
Rich Felker 6ed37ccd31 duplicate generic bits/shm.h for each arch using it, in prep to change
there are more archs sharing the generic 64-bit version of the struct,
which is uniform and much more reasonable, than sharing the current
"generic" one, and depending on how time64 sysvipc is done for 32-bit
archs, even more may be sharing the "64-bit version" in the future.

so, duplicate the current generic to all archs using it (arm, i386,
m68k, microblaze, or1k) so that the generic can be changed freely.

this is recorded as its own commit mainly as a hint to git tooling, to
assist in copy/move tracking.
2019-07-29 15:42:41 -04:00
Rich Felker 01ae3fc6d4 decouple struct stat from kernel type
presently, all archs/ABIs have struct stat matching the kernel
stat[64] type, except mips/mipsn32/mips64 which do conversion hacks in
syscall_arch.h to work around bugs in the kernel type. this patch
completely decouples them and adds a translation step to the success
path of fstatat. at present, this is just a gratuitous copying, but it
opens up multiple possibilities for future support for 64-bit time_t
on 32-bit archs and for cleaned-up/unified ABIs.

for clarity, the mips hacks are not yet removed in this commit, so the
mips kstat structs still correspond to the output of the hacks in
their syscall_arch.h files, not the raw kernel type. a subsequent
commit will fix this.
2019-07-18 19:38:12 -04:00
Szabolcs Nagy f3f96f2daa add new syscall numbers from linux v5.1
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.
2019-07-01 14:20:58 -04:00
Rich Felker 28198ac3af fix passing of 64-bit syscall arguments on microblaze
this has been wrong since the beginning of the microblaze port: the
syscall ABI for microblaze does not align 64-bit arguments on even
register boundaries. commit 788d5e24ca
exposed the problem by introducing references to a nonexistent
__syscall7. the ABI is not documented well anywhere, but I was able to
confirm against both strace source and glibc source that microblaze is
not using the alignment.

per the syscall(2) man page, posix_fadvise, ftruncate, pread, pwrite,
readahead, sync_file_range, and truncate were all affected and either
did not work at all, or only worked by chance, e.g. when the affected
argument slots were all zero.
2019-05-05 10:52:41 -04:00
Rich Felker f76d51a1cc remove cruft for supposedly-buggy clang from or1k & microblaze syscall_arch
it was never demonstrated to me that this workaround was needed, and
seems likely that, if there ever was any clang version for which it
was needed, it's old enough to be unusably buggy in other ways. if it
turns out some compilers actually can't do the register allocation
right, we'll need to replace this with inline shuffling code, since
the external __syscall dependency is being removed.
2019-04-10 18:07:51 -04:00
Szabolcs Nagy d149e69c02 add io_pgetevents and rseq syscall numbers from linux v4.18
io_pgetevents is new in linux commit
7a074e96dee62586c935c80cecd931431bfdd0be

rseq is new in linux commit
d7822b1e24f2df5df98c76f0e94a5416349ff759
2018-12-09 22:29:12 -05:00
Rich Felker a4a3e4dbc0 make thread-pointer-loading asm non-volatile
this will allow the compiler to cache and reuse the result, meaning we
no longer have to take care not to load it more than once for the sake
of archs where the load may be expensive.

depends on commit 1c84c99913 for
correctness, since otherwise the compiler could hoist loads during
stage 3 of dynamic linking before the initial thread-pointer setup.
2018-10-16 14:11:46 -04:00
Rich Felker 0cd2be2314 work around broken kernel struct ipc_perm on some big endian archs
the mode member of struct ipc_perm is specified by POSIX to have type
mode_t, which is uniformly defined as unsigned int. however, Linux
defines it with type __kernel_mode_t, and defines __kernel_mode_t as
unsigned short on some archs. since there is a subsequent padding
field, treating it as a 32-bit unsigned int works on little endian
archs, but the order is backwards on big endian archs with the
erroneous definition.

since multiple archs are affected, remedy the situation with fixup
code in the affected functions (shmctl, semctl, and msgctl) rather
than repeating the same shims in syscall_arch.h for every affected
arch.
2018-06-20 00:07:09 -04:00
Szabolcs Nagy 4dc44ce8e2 microblaze: add statx syscall from linux v4.13
statx number is allocated for microblaze in linux commit
f5ef419630e85e80284cd0256cb5a13a66bbd6c5
2017-11-05 18:41:29 -05:00
Szabolcs Nagy 8f56955713 add microblaze syscall numbers from linux v4.10
missing syscalls got allocated on microblaze.
2017-11-05 18:41:00 -05:00
Szabolcs Nagy 822dddfbf1 make syscall.h consistent with linux
most of the found naming differences don't matter to musl, because
internally it unifies the syscall names that vary across targets,
but for external code the names should match the kernel uapi.

aarch64:
	__NR_fstatat is called __NR_newfstatat in linux.
	__NR_or1k_atomic got mistakenly copied from or1k.
arm:
	__NR_arm_sync_file_range is an alias for __NR_sync_file_range2
	__NR_fadvise64_64 is called __NR_arm_fadvise64_64 in linux,
	the old non-arm name is kept too, it should not cause issues.
	(powerpc has similar nonstandard fadvise and it uses the
	normal name.)
i386:
	__NR_madvise1 was removed from linux in commit
	303395ac3bf3e2cb488435537d416bc840438fcb 2011-11-11
microblaze:
	__NR_fadvise, __NR_fstatat, __NR_pread, __NR_pwrite
	had different name in linux.
mips:
	__NR_fadvise, __NR_fstatat, __NR_pread, __NR_pwrite, __NR_select
	had different name in linux.
mipsn32:
	__NR_fstatat is called __NR_newfstatat in linux.
or1k:
	__NR__llseek is called __NR_llseek in linux.
	the old name is kept too because that's the name musl uses
	internally.
powerpc:
	__NR_{get,set}res{gid,uid}32 was never present in powerpc linux.
	__NR_timerfd was briefly defined in linux but then got renamed.
2017-09-06 19:29:25 -04:00
Rich Felker 5948bc1a64 fix omission of microblaze user.h definitions 2017-06-21 12:47:15 -04:00