aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv
AgeCommit message (Collapse)AuthorFilesLines
2022-06-02linux: Add process_mreleaseAdhemerval Zanella38-0/+124
Added in Linux 5.15 (884a7e5964e06ed93c7771c0d7cf19c09a8946f1), the new syscalls allows a caller to free the memory of a dying target process. Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-06-02linux: Add process_madviseAdhemerval Zanella38-0/+214
It was added on Linux 5.10 (ecb8ac8b1f146915aa6b96449b66dd48984caacc) with the same functionality as madvise but using a pidfd of the target process. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-06-02linux: Set tst-pidfd-consts unsupported for kernels headers older than 5.10Adhemerval Zanella1-0/+3
Instead of fail trying to build the compare source file. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Matheus Castanho <msc@linux.ibm.com> Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
2022-06-02Linux: Adjust struct rseq definition to current kernel versionFlorian Weimer1-22/+6
This definition is only used as a fallback with old kernel headers. The change follows kernel commit bfdf4e6208051ed7165b2e92035b4bf11 ("rseq: Remove broken uapi field layout on 32-bit little endian"). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-06-01linux: use statx for fstat if neither newfstatat nor fstatat64 is presentWANG Xuerui1-1/+2
LoongArch is going to be the first architecture supported by Linux that has neither fstat* nor newfstatat [1], instead exclusively relying on statx. So in fstatat64's implementation, we need to also enable statx usage if neither fstatat64 nor newfstatat is present, to prepare for this new case of kernel ABI. [1]: https://lore.kernel.org/all/20220518092619.1269111-1-chenhuacai@loongson.cn/ Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-06-01Add MADV_DONTNEED_LOCKED from Linux 5.18 to bits/mman-linux.hJoseph Myers1-0/+2
Linux 5.18 adds a constant MADV_DONTNEED_LOCKED (defined in multiple header files, but with the same value on all architectures). Add this constant to bits/mman-linux.h. Tested for x86_64.
2022-06-01Add HWCAP2_MTE3 from Linux 5.18 to AArch64 bits/hwcap.hJoseph Myers1-0/+1
Linux 5.18 defines a new AArch64 HWCAP value HWCAP2_MTE3; add it to glibc's sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h. Tested with build-many-glibcs.py for aarch64-linux-gnu.
2022-05-31Add SOL_SMC from Linux 5.18 to bits/socket.hJoseph Myers1-0/+1
Linux 5.18 adds a constant SOL_SMC to the getsockopt / setsockopt levels; add this constant to bits/socket.h. Tested for x86_64.
2022-05-26Update kernel version to 5.18 in header constant testsJoseph Myers2-2/+2
This patch updates the kernel version in the tests tst-mman-consts.py and tst-pidfd-consts.py to 5.18. (There are no new constants covered by these tests in 5.18, or in 5.17 in the case of tst-pidfd-consts.py that previously used version 5.16, that need any other header changes.) Tested with build-many-glibcs.py.
2022-05-25Update syscall-names.list for Linux 5.18Joseph Myers1-2/+2
Linux 5.18 has no new syscalls. Update the version number in syscall-names.list to reflect that it is still current for 5.18. Tested with build-many-glibcs.py.
2022-05-23linux: Add CLONE_NEWTIME from Linux 5.6 to bits/sched.hAdhemerval Zanella1-0/+4
It was added in commit 769071ac9f20b6a447410c7eaa55d1a5233ef40c.
2022-05-17linux: Add tst-pidfd.cAdhemerval Zanella2-0/+173
To check for the pidfd functions pidfd_open, pidfd_getfd, pid_send_signal, and waitid with P_PIDFD. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-05-17linux: Add P_PIDFDAdhemerval Zanella1-0/+14
It was added on Linux 5.4 (3695eae5fee0605f316fbaad0b9e3de791d7dfaf) to extend waitid to wait on pidfd. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-05-17linux: Add pidfd_send_signalAdhemerval Zanella36-0/+43
This was added on Linux 5.1(3eb39f47934f9d5a3027fe00d906a45fe3a15fad) as a way to avoid the race condition of using kill (where PID might be reused by the kernel between between obtaining the pid and sending the signal). If the siginfo_t argument is NULL then pidfd_send_signal is equivalent to kill. If it is not NULL pidfd_send_signal is equivalent to rt_sigqueueinfo. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-05-17linux: Add pidfd_getfdAdhemerval Zanella36-0/+43
This was added on Linux 5.6 (8649c322f75c96e7ced2fec201e123b2b073bf09) as a way to retrieve a file descriptors for another process though pidfd (created either with CLONE_PIDFD or pidfd_getfd). The functionality is similar to recvmmsg SCM_RIGHTS. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-05-17linux: Add pidfd_openAdhemerval Zanella38-1/+129
This was added on Linux 5.3 (32fcb426ec001cb6d5a4a195091a8486ea77e2df) as a way to retrieve a pid file descriptors for process that has not been created CLONE_PIDFD (by usual fork/clone). Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-05-17linux: Add a getauxval test [BZ #23293]Szabolcs Nagy2-0/+75
This is for bug 23293 and it relies on the glibc test system running tests via explicit ld.so invokation by default. Reviewed-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-05-17rtld: Remove DL_ARGV_NOT_RELRO and make _dl_skip_args constSzabolcs Nagy1-4/+0
_dl_skip_args is always 0, so the target specific code that modifies argv after relro protection is applied is no longer used. After the patch relro protection is applied to _dl_argv consistently on all targets. Reviewed-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-05-16Remove dl-librecon.h header.Adhemerval Zanella2-60/+0
The Linux version used by i686 and m68k provide three overrrides for generic code: 1. DISTINGUISH_LIB_VERSIONS to print additional information when libc5 is used by a dependency. 2. EXTRA_LD_ENVVARS to that enabled LD_LIBRARY_VERSION environment variable. 3. EXTRA_UNSECURE_ENVVARS to add two environment variables related to aout support. None are really requires, it has some decades since libc5 or aout suppported was removed and Linux even remove support for aout files. The LD_LIBRARY_VERSION is also dead code, dl_correct_cache_id is not used anywhere. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-05-16elf: Remove ldconfig kernel version checkAdhemerval Zanella8-80/+64
Now that it was removed on libc.so.
2022-05-16Remove kernel version checkAdhemerval Zanella7-186/+7
The kernel version check is used to avoid glibc to run on older kernels where some syscall are not available and fallback code are not enabled to handle graciously fail. However, it does not prevent if the kernel does not correctly advertise its version through vDSO note, uname or procfs. Also kernel version checks are sometime not desirable by users, where they want to deploy on different system with different kernel version knowing the minimum set of syscall is always presented on such systems. The kernel version check has been removed along with the LD_ASSUME_KERNEL environment variable. The minimum kernel used to built glibc is still provided through NT_GNU_ABI_TAG ELF note and also printed when libc.so is issued. Checked on x86_64-linux-gnu.
2022-05-16linux: Use /sys/devices/system/cpu on __get_nprocs_conf (BZ#28991)Adhemerval Zanella1-32/+4
Currently on Linux __get_nprocs_conf first tries to enumerate the cpus present in the system by iterating on /sys/devices/system/cpuX directories. This only enumerates the CPUs that are present in system (but possibly offline), not taking in account possible CPU that might added in the system through hotplugging. Linux provides the maximum number of configured cpus on the /sys/devices/system/cpu file. Although it might present a larger value of possible active CPUs on some system (where kernel either get the information from firmaware or is configured at boot time), the information is what kernel presents to userland. This also change the returned value of _SC_NPROCESSORS_CONF, which aligns as the maximum configure cpu in the system. Checked on x86_64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-05-16csu: Implement and use _dl_early_allocate during static startupFlorian Weimer1-0/+82
This implements mmap fallback for a brk failure during TLS allocation. scripts/tls-elf-edit.py is updated to support the new patching method. The script no longer requires that in the input object is of ET_DYN type. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-05-16Linux: Introduce __brk_call for invoking the brk system callFlorian Weimer5-78/+71
Alpha and sparc can now use the generic implementation. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-05-13stdio: Remove the usage of $(fno-unit-at-a-time) for siglist.cAdhemerval Zanella1-2/+5
The siglist.c is built with -fno-toplevel-reorder to avoid compiler to reorder the compat assembly directives due an assembler issue [1] (fixed on 2.39). This patch removes the compiler flags by split the compat symbol generation in two phases. First the __sys_siglist and __sys_sigabbrev without any compat symbol directive is preprocessed to generate an assembly source code. This generate assembly is then used as input on a platform agnostic siglist.S which then creates the compat definitions. This prevents compiler to move any compat directive prior the _sys_errlist definition itself. Checked on a make check run-built-tests=no on all affected ABIs. Reviewed-by: Fangrui Song <maskray@google.com>
2022-05-13stdio: Remove the usage of $(fno-unit-at-a-time) for errlist.cAdhemerval Zanella6-12/+21
The errlist.c is built with -fno-toplevel-reorder to avoid compiler to reorder the compat assembly directives due an assembler issue [1] (fixed on 2.39). This patch removes the compiler flags by split the compat symbol generation in two phases. First the _sys_errlist_internal internal without any compat symbol directive is preprocessed to generate an assembly source code. This generate assembly is then used as input on a platform agnostic errlist-data.S which then creates the compat definitions. This prevents compiler to move any compat directive prior the _sys_errlist_internal definition itself. Checked on a make check run-built-tests=no on all affected ABIs. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=29012
2022-05-09Linux: Implement a useful version of _startup_fatalFlorian Weimer3-19/+65
On i386 and ia64, the TCB is not available at this point. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-05-09ia64: Always define IA64_USE_NEW_STUB as a flag macroFlorian Weimer2-13/+15
And keep the previous definition if it exists. This allows disabling IA64_USE_NEW_STUB while keeping USE_DL_SYSINFO defined. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-05-06linux: Fix posix_spawn return code if clone fails (BZ#29109)Adhemerval Zanella1-1/+1
The __clone_internal returns the error on errno. Checked on x86_64-linux-gnu.
2022-05-05clock_adjtime: Use __nonnull to avoid null pointerXiaoming Ni2-3/+3
clock_adjtime()/clock_adjtime64() Add __nonnull((2)) to avoid null pointer access. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27662 Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29084 Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-05-05ntp_xxxtimex: Use __nonnull to avoid null pointerXiaoming Ni2-8/+8
ntp_gettime() ntp_gettime64() ntp_gettimex() ntp_gettimex64() ntp_adjtime() Add __nonnull((1)) to avoid null pointer access. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27662 Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29084 Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-05-05adjtimex/adjtimex64: Use __nonnull to avoid null pointerXiaoming Ni2-4/+4
Add __nonnull((1)) to the adjtimex()/adjtimex64() function declaration to avoid null pointer access. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27662 Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29084 Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-05-04Linux: Define MMAP_CALL_INTERNALFlorian Weimer3-12/+30
Unlike MMAP_CALL, this avoids a TCB dependency for an errno update on failure. <mmap_internal.h> cannot be included as is on several architectures due to the definition of page_unit, so introduce a separate header file for the definition of MMAP_CALL and MMAP_CALL_INTERNAL, <mmap_call.h>. Reviewed-by: Stefan Liebler <stli@linux.ibm.com>
2022-05-04i386: Honor I386_USE_SYSENTER for 6-argument Linux system callsFlorian Weimer3-3/+37
Introduce an int-80h-based version of __libc_do_syscall and use it if I386_USE_SYSENTER is defined as 0. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-05-04i386: Remove OPTIMIZE_FOR_GCC_5 from Linux libc-do-syscall.SFlorian Weimer1-3/+0
After commit a78e6a10d0b50d0ca80309775980fc99944b1727 ("i386: Remove broken CAN_USE_REGISTER_ASM_EBP (bug 28771)"), it is never defined. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-04-28linux: Fix fchmodat with AT_SYMLINK_NOFOLLOW for 64 bit time_t (BZ#29097)Adhemerval Zanella1-2/+2
The AT_SYMLINK_NOFOLLOW emulation ues the default 32 bit stat internal calls, which fails with EOVERFLOW if the file constains timestamps beyond 2038. Checked on i686-linux-gnu.
2022-04-27posix/glob.c: update from gnulibDJ Delorie1-0/+1
Copied from gnulib/lib/glob.c in order to fix rhbz 1982608 Also fixes swbz 25659 Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-04-27linux: Fix missing internal 64 bit time_t stat usageAdhemerval Zanella2-4/+4
These are two missing spots initially done by 52a5fe70a2c77935. Checked on i686-linux-gnu.
2022-04-22Default to --with-default-link=no (bug 25812)Florian Weimer1-0/+6
This is necessary to place the libio vtables into the RELRO segment. New tests elf/tst-relro-ldso and elf/tst-relro-libc are added to verify that this is what actually happens. The new tests fail on ia64 due to lack of (default) RELRO support inbutils, so they are XFAILed there.
2022-04-19elf: Remove __libc_init_secureFangrui Song1-24/+0
After 73fc4e28b9464f0e13edc719a5372839970e7ddb, __libc_enable_secure_decided is always 0 and a statically linked executable may overwrite __libc_enable_secure without considering AT_SECURE. The __libc_enable_secure has been correctly initialized in _dl_aux_init, so just remove __libc_enable_secure_decided and __libc_init_secure. This allows us to remove some startup_get*id functions from 22b79ed7f413cd980a7af0cf258da5bf82b6d5e5. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-04-18mips: Fix mips64n32 64 bit time_t stat support (BZ#29069)=Joshua Kinard1-15/+23
Add missing support initially added by 4e8521333bea6e89fcef1020 (which missed n32 stat).
2022-04-13Replace {u}int_fast{16|32} with {u}int32_tNoah Goldstein1-1/+1
On 32-bit machines this has no affect. On 64-bit machines {u}int_fast{16|32} are set as {u}int64_t which is often not ideal. Particularly x86_64 this change both saves code size and may save instruction cost. Full xcheck passes on x86_64.
2022-04-10powerpc: Relocate stinfo->mainAlan Modra2-2/+19
start_addresses in sysdeps/powerpc/powerpc64/start.S is historical baggage that should disappear. Until someone does that, relocating stinfo->main by hand is one solution to the fact that the field may be unrelocated at the time it is accessed. This is similar to what is done for dynamic tags via the D_PTR macro. stinfo->init and stinfo->fini are zero in both powerpc64/start.S and powerpc32/start.S, so make it a little more obvious they are unused by passing NULLs to LIBC_START_MAIN. The makefile change is needed to pick up elf/dl-static-tls.h from dl-machine.h. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2022-04-10linux: Constify rfv variable in dl_vdso_vsymAlan Modra1-1/+1
Compilers may decide to put the rfv variable in .data rather than on the stack. It's slightly better to put it in .data.rel.ro.local instead. Regardles of that, making it const may enable further optimisations. Found when examining relative relocations (GOT ones in particular) as part of enabling static-pie for PowerPC64.
2022-04-05linux: Fix __closefrom_fallback iterates until max int (BZ#28993)Adhemerval Zanella1-5/+6
The __closefrom_fallback tries to get a available file descriptor if the initial open ("/proc/self/fd/", ...) fails. It assumes the failure would be only if procfs is not mount (ENOENT), however if the the proc file is not accessible (due some other kernel filtering such apparmor) it will iterate over a potentially large file set issuing close calls. It should only try the close fallback if open returns EMFILE, ENFILE, or ENOMEM. Checked on x86_64-linux-gnu.
2022-03-28Add HWCAP2_AFP, HWCAP2_RPRES from Linux 5.17 to AArch64 bits/hwcap.hJoseph Myers1-0/+2
Add the new HWCAP2_AFP and HWCAP2_RPRES constants from Linux 5.17. Tested with build-many-glibcs.py for aarch64-linux-gnu.
2022-03-24Update kernel version to 5.17 in tst-mman-consts.pyJoseph Myers1-1/+1
This patch updates the kernel version in the test tst-mman-consts.py to 5.17. (There are no new MAP_* constants covered by this test in 5.17 that need any other header changes.) Tested with build-many-glibcs.py.
2022-03-23Update syscall lists for Linux 5.17Joseph Myers27-2/+29
Linux 5.17 has one new syscall, set_mempolicy_home_node. Update syscall-names.list and regenerate the arch-syscall.h headers with build-many-glibcs.py update-syscalls. Tested with build-many-glibcs.py.
2022-03-23Fix ununsed fstatat64_time64_statxAdhemerval Zanella1-5/+5
It is only called for legacy ABIs.
2022-03-15hppa: Use END instead of PSEUDO_END in swapcontext.SJohn David Anglin1-1/+1