about summary refs log tree commit diff
path: root/sysdeps/mach
Commit message (Collapse)AuthorAgeFilesLines
* dlfcn: Move dlmopen into libcFlorian Weimer2021-06-032-1/+3
| | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* dlfcn: Move dlsym into libcFlorian Weimer2021-06-032-1/+2
| | | | | | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. In elf/Makefile, remove the $(libdl) dependency from testobj1.so because it the unused libdl DSO now causes elf/tst-unused-deps to fail. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* dlfcn: Move dladdr into libcFlorian Weimer2021-06-032-1/+2
| | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* dlfcn: Move dlclose into libcFlorian Weimer2021-06-032-1/+2
| | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* dlfcn: Move dlerror into libcFlorian Weimer2021-06-022-1/+2
| | | | | | | | | | | | | | The symbol was moved using scripts/move-symbol-to-libc.py. There is a minor functionality enhancement: dlerror now sets errno if it was set as part of the exception. (This is the result of using %m in asprintf, to avoid the strerror PLT call.) The previous errno value upon function return was unpredictable. Documenting this as a feature is premature; we need to make sure that the error codes are meaningful when they are set by the dynamic loader. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add missing symbols to Version filesFlorian Weimer2021-06-021-0/+4
| | | | | | | | | Some symbols have explicit versioned_symbol or compat_symbol markers in the sources, but no corresponding entry in the Versions files. This presently works because the local: * directive is only applied to the base version. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* hurd: Add execveatSamuel Thibault2021-05-183-43/+121
|
* Add C2X timespec_getresJoseph Myers2021-05-171-0/+1
| | | | | | | | | | | | | | | | | | | ISO C2X adds a timespec_getres function alongside the C11 timespec_get, with functionality similar to that of POSIX clock_getres (including allowing a NULL pointer to be passed to the function). Implement this function for glibc, similarly to the implementation of timespec_get. This includes a basic test like that of timespec_get, but no documentation in the manual, given that TIME_UTC and timespec_get aren't documented in the manual at all. The handling of 64-bit time follows that in timespec_get; people maintaining patch series for 64-bit time will need to update them accordingly (to export __timespec_getres64, redirect calls in time.h and run the test for _TIME_BITS=64). Tested for x86_64 and x86, and (previous version; only testcase differs) with build-many-glibcs.py.
* Hurd: Add missing hidden proto definition for __ttyname_rFlorian Weimer2021-05-101-1/+1
|
* Annotate additional APIs with GCC attribute access.Martin Sebor2021-05-061-1/+1
| | | | | | | | | | | | | | | | This change continues the improvements to compile-time out of bounds checking by decorating more APIs with either attribute access, or by explicitly providing the array bound in APIs such as tmpnam() that expect arrays of some minimum size as arguments. (The latter feature is new in GCC 11.) The only effects of the attribute and/or the array bound is to check and diagnose calls to the functions that fail to provide a sufficient number of elements, and the definitions of the functions that access elements outside the specified bounds. (There is no interplay with _FORTIFY_SOURCE here yet.) Tested with GCC 7 through 11 on x86_64-linux.
* linux: Add execveat system call wrapperAlexandra Hájková2021-05-031-0/+1
| | | | | | | | | | | It operates similar to execve and it is is already used to implement fexecve without requiring /proc to be mounted. However, different than fexecve, if the syscall is not supported by the kernel an error is returned instead of trying a fallback. Checked on x86_64-linux-gnu and powerpc64le-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Add pthread-in-libc, libpthread-routines-var, librt-routines-varFlorian Weimer2021-05-032-0/+6
| | | | | | | | These make variables can be used to add routines to different libraries for the Hurd and Linux builds. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* hurd: Export _hurd_libc_proc_initSamuel Thibault2021-04-121-0/+1
| | | | | hurd's libdiskfs needs to be able to call _hurd_init + _hurd_libc_proc_init for bootstrap initialization.
* Move __isnanf128 to libc.soSiddhesh Poyarekar2021-03-302-1/+2
| | | | | | | | All of the isnan functions are in libc.so due to printf_fp, so move __isnanf128 there too for consistency. Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@ascii.art.br> Reviewed-by: Florian Weimer <fweimer@redhat.com>
* hurd: handle EINTR during critical sectionsSamuel Thibault2021-03-2322-2/+102
| | | | | | | | | During critical sections, signal handling is deferred and thus RPCs return EINTR, even if SA_RESTART is set. We thus have to restart the whole critical section in that case. This also adds HURD_CRITICAL_UNLOCK in the cases where one wants to break the section in the middle.
* signal: Add __libc_sigactionAdhemerval Zanella2021-03-181-7/+5
| | | | | | | | The generic implementation basically handle the system agnostic logic (filtering out the invalid signals) while the __libc_sigaction is the function with implements the system and architecture bits. Checked on x86_64-linux-gnu and i686-linux-gnu.
* posix: Consolidate register-atforkAdhemerval Zanella2021-03-121-11/+4
| | | | | | | | | | | | | Both htl and nptl uses a different data structure to implement atfork handlers. The nptl one was refactored by 27761a1042d to use a dynarray which simplifies the code. This patch moves the nptl one to be the generic implementation and replace Hurd linked one. Different than previous NPTL, Hurd also uses a global lock, so performance should be similar. Checked on x86_64-linux-gnu, i686-linux-gnu, and with a build for i686-gnu.
* Implement <unwind-link.h> for dynamically loading the libgcc_s unwinderFlorian Weimer2021-03-011-0/+3
| | | | | | | | | | This will be used to consolidate the libgcc_s access for backtrace and pthread_cancel. Unlike the existing backtrace implementations, it provides some hardening based on pointer mangling. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Reduce the statically linked startup code [BZ #23323]Florian Weimer2021-02-251-0/+1
| | | | | | | | | | | | | | | | | | | It turns out the startup code in csu/elf-init.c has a perfect pair of ROP gadgets (see Marco-Gisbert and Ripoll-Ripoll, "return-to-csu: A New Method to Bypass 64-bit Linux ASLR"). These functions are not needed in dynamically-linked binaries because DT_INIT/DT_INIT_ARRAY are already processed by the dynamic linker. However, the dynamic linker skipped the main program for some reason. For maximum backwards compatibility, this is not changed, and instead, the main map is consulted from __libc_start_main if the init function argument is a NULL pointer. For statically linked binaries, the old approach based on linker symbols is still used because there is nothing else available. A new symbol version __libc_start_main@@GLIBC_2.34 is introduced because new binaries running on an old libc would not run their ELF constructors, leading to difficult-to-debug issues.
* hurd: Fix fstatfs build failureAdhemerval Zanella2021-02-111-1/+1
| | | | | | | It was added by 1bfbaf7130 where it added a libc_hidden_proto for __fstatfs but it didn't update the Hurd version as well. Checked with a build for i686-gnu.
* hurd TIOCFLUSH: fix fixing argumentSamuel Thibault2021-02-011-2/+2
| | | | The argument actually used inside send_rpc is argptr, not arg.
* hurd TIOCFLUSH: Cope BSD 4.1 semanticSamuel Thibault2021-02-011-0/+4
| | | | | | BSD 4.1 did not have an argument for TIOCFLUSH, BSD 4.2 added it. There are still a lot of applications out there that pass a NULL argument to TIOCFLUSH, so we should rather cope with it.
* Revert "linux: Move {f}xstat{at} to compat symbols" for static buildAdhemerval Zanella2021-01-218-12/+9
| | | | | | | | | | | | | | This reverts commit 20b39d59467b0c1d858e89ded8b0cebe55e22f60 for static library. This avoids the need to rebuild the world for the case where libstdc++ (and potentially other libraries) are linked to a old glibc. To avoid requering to provide xstat symbols for newer ABIs (such as riscv32) a new LIB_COMPAT macro is added. It is similar to SHLIB_COMPAT but also works for static case (thus evaluating similar to SHLIB_COMPAT for both shared and static case). Checked with a check-abi on all affected ABIs. I also check if the static library does contains the xstat symbols.
* <sys/platform/x86.h>: Remove the C preprocessor magicH.J. Lu2021-01-212-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In <sys/platform/x86.h>, define CPU features as enum instead of using the C preprocessor magic to make it easier to wrap this functionality in other languages. Move the C preprocessor magic to internal header for better GCC codegen when more than one features are checked in a single expression as in x86-64 dl-hwcaps-subdirs.c. 1. Rename COMMON_CPUID_INDEX_XXX to CPUID_INDEX_XXX. 2. Move CPUID_INDEX_MAX to sysdeps/x86/include/cpu-features.h. 3. Remove struct cpu_features and __x86_get_cpu_features from <sys/platform/x86.h>. 4. Add __x86_get_cpuid_feature_leaf to <sys/platform/x86.h> and put it in libc. 5. Make __get_cpu_features() private to glibc. 6. Replace __x86_get_cpu_features(N) with __get_cpu_features(). 7. Add _dl_x86_get_cpu_features to GLIBC_PRIVATE. 8. Use a single enum index for each CPU feature detection. 9. Pass the CPUID feature leaf to __x86_get_cpuid_feature_leaf. 10. Return zero struct cpuid_feature for the older glibc binary with a smaller CPUID_INDEX_MAX [BZ #27104]. 11. Inside glibc, use the C preprocessor magic so that cpu_features data can be loaded just once leading to more compact code for glibc. 256 bits are used for each CPUID leaf. Some leaves only contain a few features. We can add exceptions to such leaves. But it will increase code sizes and it is harder to provide backward/forward compatibilities when new features are added to such leaves in the future. When new leaves are added, _rtld_global_ro offsets will change which leads to race condition during in-place updates. We may avoid in-place updates by 1. Rename the old glibc. 2. Install the new glibc. 3. Remove the old glibc. NB: A function, __x86_get_cpuid_feature_leaf , is used to avoid the copy relocation issue with IFUNC resolver as shown in IFUNC resolver tests.
* Hurd: Add rtld-strncpy-c.cH.J. Lu2021-01-191-0/+1
| | | | | All IFUNC functions which are used in ld.so must have a rtld version if the IFUNC version isn't safe to use in ld.so.
* hurd: Fix mmap(!MAP_FIXED) on bogus addressSamuel Thibault2021-01-041-3/+6
| | | | | | | | In the !MAP_FIXED case, when a bogus address is given mmap should pick up a valide address rather than returning EINVAL: Posix only talks about EINVAL for the MAP_FIXED case. This fixes long-running ghc processes.
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-02383-383/+383
| | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
* io: Remove xmknod{at} implementationsAdhemerval Zanella2020-12-292-31/+1
| | | | | | | | | | With xmknod wrapper functions removed (589260cef8), the mknod functions are now properly exported, and version is done using symbols versioning instead of the extra _MKNOD_* argument. It also allows us to consolidate Linux and Hurd mknod implementation. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* io: Remove xstat implementationsAdhemerval Zanella2020-12-291-1/+3
| | | | | | | | With xstat wrapper functions removed (8ed005daf0), the stat functions are now properly exported, and version is done using symbols versioning instead of the extra _STAT_* argument. Reviewed-by: Lukasz Majewski <lukma@denx.de>
* hurd: Add WSTOPPED/WCONTINUED/WEXITED/WNOWAIT support [BZ #23091]Samuel Thibault2020-12-281-10/+30
| | | | | | The new __proc_waitid RPC now expects WEXITED to be passed, allowing to properly implement waitid, and thus define the missing W* macros (according to FreeBSD values).
* hurd: set sigaction for signal preemptors in arch-independent fileSamuel Thibault2020-12-261-15/+2
| | | | | | Instead of having the arch-specific trampoline setup code detect whether preemption happened or not, we'd rather pass it the sigaction. In the future, this may also allow to change sa_flags from post_signal().
* hurd: Fix spawni SPAWN_XFLAGS_TRY_SHELL with empty argvSamuel Thibault2020-12-261-1/+5
| | | | | When argv is empty, we need to add the original script to be run on the shell command line.
* hurd: Try shell in posix_spawn* only in compat modeSamuel Thibault2020-12-261-1/+1
| | | | Reported by Bruno Haible <bruno@clisp.org>
* hurd: Make trampoline fill siginfo ss_sp from sc_uespSamuel Thibault2020-12-211-1/+1
| | | | Mach actually rather fills the uesp field, not esp.
* hurd: implement SA_SIGINFO signal handlers.Jeremie Koenig2020-12-216-62/+198
| | | | | | | SA_SIGINFO is actually just another way of expressing what we were already passing over with struct sigcontext. This just introduces the SIGINFO interface and fixes the posix values when that interface is requested by the application.
* hurd: Note when the vm_map kernel bug was fixedSamuel Thibault2020-12-201-1/+1
| | | | | dl-sysdep has been wanting to use high bits in the vm_map mask for decades, but that was only implemented lately.
* Replace __libc_multiple_libcs with __libc_initial flagFlorian Weimer2020-12-162-6/+6
| | | | | | | | | | | | | | Change sbrk to fail for !__libc_initial (in the generic implementation). As a result, sbrk is (relatively) safe to use for the __libc_initial case (from the main libc). It is therefore no longer necessary to avoid using it in that case (or updating the brk cache), and the __libc_initial flag does not need to be updated as part of dlmopen or static dlopen. As before, direct brk system calls on Linux may lead to memory corruption. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* htl: Get sem_open/sem_close/sem_unlink support [BZ #25524]Samuel Thibault2020-12-161-7/+0
| | | | | This just moves the existing nptl implementation to reuse as it is in htl.
* htl: Add pshared semaphore supportSamuel Thibault2020-12-161-1/+0
| | | | | | The implementation is extremely similar to the nptl implementation, but with slight differences in the futex interface. This fixes some of BZ 25521.
* hurd: Add __libc_open and __libc_closeSamuel Thibault2020-12-161-0/+1
| | | | Needed by libpthread for sem_open and sem_close
* hurd: make lll_* take a variable instead of a ptrSamuel Thibault2020-12-169-26/+26
| | | | | To be coherent with other ports, let's make lll_* take a variable, and rename those that keep taking a ptr into __lll_*.
* hurd: Rename LLL_INITIALIZER to LLL_LOCK_INITIALIZERSamuel Thibault2020-12-161-4/+4
| | | | To get coherent with other ports.
* nss: Implement <nss_database.h>Florian Weimer2020-12-041-0/+8
| | | | | | | | | | | This code manages the mappings of the available databases in NSS (i.e. passwd, hosts, netgroup, etc) with the actions that should be taken to do a query on those databases. This is the main API between query functions scattered throughout glibc and the underlying code (actions, modules, etc). Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* hurd: Enable using ifuncSamuel Thibault2020-11-162-6/+0
| | | | Bugs have been fixed in binutils/gcc/glibc.
* Add {,sysdep-}ld-library-path make variableSamuel Thibault2020-11-161-0/+2
| | | | | | | | On GNU/Hurd we not only need $(common-objpfx) in LD_LIBRARY_PATH when loading dynamic objects, but also $(common-objpfx)/mach and $(common-objpfx)/hurd. This adds an ld-library-path variable to be used as LD_LIBRARY_PATH basis in Makefiles, and a sysdep-ld-library-path variable for sysdeps to add some more paths, here mach/ and hurd/.
* hurd: let _dl_argv and __libc_stack_end be relroSamuel Thibault2020-11-151-7/+0
| | | | libpthread does not switch stacks.
* hurd: Remove some remnants of cthreadsSamuel Thibault2020-11-156-8/+10
| | | | | Libc has actually been using mach's lock-internal.h mutex for a long time already.
* hurd: Drop CLOCK_MONOTONIC change which slipped inSamuel Thibault2020-11-141-1/+0
|
* hurd: make ptsname fail with ENOTTY on non-master-ptySamuel Thibault2020-11-141-0/+8
|
* mach: Add missing assert.h includeSamuel Thibault2020-11-141-0/+2
|