aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd')
-rw-r--r--sysdeps/mach/hurd/Makefile7
-rw-r--r--sysdeps/mach/hurd/bits/ioctls.h31
-rw-r--r--sysdeps/mach/hurd/dl-execstack.c7
-rw-r--r--sysdeps/mach/hurd/dup3.c62
-rw-r--r--sysdeps/mach/hurd/fcntl.c53
-rw-r--r--sysdeps/mach/hurd/futimens.c8
-rw-r--r--sysdeps/mach/hurd/futimes.c8
-rw-r--r--sysdeps/mach/hurd/getrandom-internal.h30
-rw-r--r--sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c7
-rw-r--r--sysdeps/mach/hurd/htl/pt-sigstate-init.c3
-rw-r--r--sysdeps/mach/hurd/htl/pt-sysdep.c1
-rw-r--r--sysdeps/mach/hurd/htl/pt-sysdep.h2
-rw-r--r--sysdeps/mach/hurd/i386/bits/sigcontext.h2
-rw-r--r--sysdeps/mach/hurd/i386/htl/pt-machdep.c2
-rw-r--r--sysdeps/mach/hurd/i386/htl/pt-setup.c1
-rw-r--r--sysdeps/mach/hurd/i386/libc.abilist72
-rw-r--r--sysdeps/mach/hurd/i386/libm.abilist16
-rw-r--r--sysdeps/mach/hurd/i386/libpthread.abilist35
-rw-r--r--sysdeps/mach/hurd/i386/sigreturn.c35
-rw-r--r--sysdeps/mach/hurd/renameat2.c19
-rw-r--r--sysdeps/mach/hurd/symlinkat.c2
-rw-r--r--sysdeps/mach/hurd/utime-helper.c62
-rw-r--r--sysdeps/mach/hurd/x86/trampoline.c105
-rw-r--r--sysdeps/mach/hurd/x86_64/bits/sigcontext.h2
-rw-r--r--sysdeps/mach/hurd/x86_64/htl/pt-machdep.c2
-rw-r--r--sysdeps/mach/hurd/x86_64/htl/pt-setup.c1
-rw-r--r--sysdeps/mach/hurd/x86_64/libc.abilist70
-rw-r--r--sysdeps/mach/hurd/x86_64/libm.abilist16
-rw-r--r--sysdeps/mach/hurd/x86_64/libpthread.abilist35
-rw-r--r--sysdeps/mach/hurd/x86_64/sigreturn.c35
30 files changed, 549 insertions, 182 deletions
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index 994de00..32bba61 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -311,9 +311,6 @@ endif
ifeq ($(subdir),htl)
tests-unsupported += tst-basic7
endif
-ifeq ($(subdir),io)
-tests-unsupported += test-lfs
-endif
ifeq ($(subdir),libio)
tests-unsupported += tst-asprintf-null
endif
@@ -323,6 +320,7 @@ tests-unsupported += tst-malloc-thread-fail-malloc-check
tests-unsupported += tst-malloc-thread-fail-mcheck
tests-unsupported += tst-malloc-thread-fail-malloc-hugetlb1
tests-unsupported += tst-malloc-thread-fail-malloc-hugetlb2
+tests-unsupported += tst-malloc-thread-fail-malloc-largetcache
tests-unsupported += tst-dynarray-fail
endif
ifeq ($(subdir),misc)
@@ -339,7 +337,8 @@ ifeq ($(subdir),stdlib)
tests-unsupported += test-bz22786 tst-strtod-overflow
# pthread_cleanup_combined_push/pthread_cleanup_combined_pop requires cleanup
# support (BZ 32058).
-test-xfail-tst-qsortx7 = yes
+test-xfail-tst-qsort7-mem = yes
+test-xfail-tst-qsortx7-mem = yes
endif
ifeq ($(subdir),timezone)
tests-unsupported += tst-tzset
diff --git a/sysdeps/mach/hurd/bits/ioctls.h b/sysdeps/mach/hurd/bits/ioctls.h
index f01316d..faf1373 100644
--- a/sysdeps/mach/hurd/bits/ioctls.h
+++ b/sysdeps/mach/hurd/bits/ioctls.h
@@ -324,15 +324,8 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 };
From 4.4 <sys/ioctl_compat.h>. */
#ifdef __USE_MISC
-#ifdef USE_OLD_TTY
-# undef TIOCGETD
-# define TIOCGETD _IOR('t', 0, int) /* get line discipline */
-# undef TIOCSETD
-# define TIOCSETD _IOW('t', 1, int) /* set line discipline */
-#else
-# define OTIOCGETD _IOR('t', 0, int) /* get line discipline */
-# define OTIOCSETD _IOW('t', 1, int) /* set line discipline */
-#endif
+#define OTIOCGETD _IOR('t', 0, int) /* get line discipline */
+#define OTIOCSETD _IOW('t', 1, int) /* set line discipline */
#define TIOCHPCL _IO('t', 2) /* hang up on last close */
#define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */
#define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */
@@ -411,26 +404,6 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 };
#define OTTYDISC 0
#define NETLDISC 1
#define NTTYDISC 2
-
-/* From 4.4 <sys/ttydev.h>. */
-#ifdef USE_OLD_TTY
-# define B0 0
-# define B50 1
-# define B75 2
-# define B110 3
-# define B134 4
-# define B150 5
-# define B200 6
-# define B300 7
-# define B600 8
-# define B1200 9
-# define B1800 10
-# define B2400 11
-# define B4800 12
-# define B9600 13
-# define EXTA 14
-# define EXTB 15
-#endif /* USE_OLD_TTY */
#endif
#endif /* bits/ioctls.h */
diff --git a/sysdeps/mach/hurd/dl-execstack.c b/sysdeps/mach/hurd/dl-execstack.c
index 0617d3a..9e69169 100644
--- a/sysdeps/mach/hurd/dl-execstack.c
+++ b/sysdeps/mach/hurd/dl-execstack.c
@@ -26,12 +26,11 @@ extern struct hurd_startup_data *_dl_hurd_data attribute_hidden;
so as to mprotect it. */
int
-_dl_make_stack_executable (void **stack_endp)
+_dl_make_stack_executable (const void *stack_endp)
{
/* Challenge the caller. */
- if (__builtin_expect (*stack_endp != __libc_stack_end, 0))
+ if (__glibc_unlikely (stack_endp != __libc_stack_end))
return EPERM;
- *stack_endp = NULL;
#if IS_IN (rtld)
if (__mprotect ((void *)_dl_hurd_data->stack_base, _dl_hurd_data->stack_size,
@@ -39,7 +38,7 @@ _dl_make_stack_executable (void **stack_endp)
return errno;
/* Remember that we changed the permission. */
- GL(dl_stack_flags) |= PF_X;
+ GL(dl_stack_prot_flags) |= PROT_EXEC;
return 0;
#else
diff --git a/sysdeps/mach/hurd/dup3.c b/sysdeps/mach/hurd/dup3.c
index 22af45b..49545ae 100644
--- a/sysdeps/mach/hurd/dup3.c
+++ b/sysdeps/mach/hurd/dup3.c
@@ -69,6 +69,7 @@ __dup3 (int fd, int fd2, int flags)
{
/* Get a hold of the destination descriptor. */
struct hurd_fd *d2;
+ error_t err;
__mutex_lock (&_hurd_dtable_lock);
@@ -107,22 +108,51 @@ __dup3 (int fd, int fd2, int flags)
}
else
{
- /* Give the ports each a user ref for the new descriptor. */
- __mach_port_mod_refs (__mach_task_self (), port,
- MACH_PORT_RIGHT_SEND, 1);
- if (ctty != MACH_PORT_NULL)
- __mach_port_mod_refs (__mach_task_self (), ctty,
- MACH_PORT_RIGHT_SEND, 1);
-
- /* Install the ports and flags in the new descriptor slot. */
- __spin_lock (&d2->port.lock);
- if (flags & O_CLOEXEC)
- d2->flags = d_flags | FD_CLOEXEC;
- else
- /* dup clears FD_CLOEXEC. */
- d2->flags = d_flags & ~FD_CLOEXEC;
- _hurd_port_set (&d2->ctty, ctty);
- _hurd_port_locked_set (&d2->port, port); /* Unlocks D2. */
+ /* Give the io server port a user ref for the new descriptor. */
+ err = __mach_port_mod_refs (__mach_task_self (), port,
+ MACH_PORT_RIGHT_SEND, 1);
+
+ if (err == KERN_UREFS_OVERFLOW)
+ fd2 = __hurd_fail (EMFILE);
+ else if (err)
+ fd2 = __hurd_fail (EINVAL);
+ else if (ctty != MACH_PORT_NULL)
+ {
+ /* We have confirmed the io server port has got a user ref
+ count, now give ctty port a user ref for the new
+ descriptor. */
+ err = __mach_port_mod_refs (__mach_task_self (), ctty,
+ MACH_PORT_RIGHT_SEND, 1);
+
+ if (err)
+ {
+ /* In this case the io server port has got a ref count
+ but the ctty port failed to get one, so we need to
+ clean the ref count we just assigned. */
+ __mach_port_mod_refs (__mach_task_self (), port,
+ MACH_PORT_RIGHT_SEND, -1);
+
+ if (err == KERN_UREFS_OVERFLOW)
+ fd2 = __hurd_fail (EMFILE);
+ else
+ fd2 = __hurd_fail (EINVAL);
+ }
+ }
+
+ if (!err)
+ {
+ /* The ref counts of the ports are incremented
+ successfully. */
+ /* Install the ports and flags in the new descriptor slot. */
+ __spin_lock (&d2->port.lock);
+ if (flags & O_CLOEXEC)
+ d2->flags = d_flags | FD_CLOEXEC;
+ else
+ /* dup clears FD_CLOEXEC. */
+ d2->flags = d_flags & ~FD_CLOEXEC;
+ _hurd_port_set (&d2->ctty, ctty);
+ _hurd_port_locked_set (&d2->port, port); /* Unlocks D2. */
+ }
}
}
diff --git a/sysdeps/mach/hurd/fcntl.c b/sysdeps/mach/hurd/fcntl.c
index a65c190..de576af 100644
--- a/sysdeps/mach/hurd/fcntl.c
+++ b/sysdeps/mach/hurd/fcntl.c
@@ -83,18 +83,47 @@ __libc_fcntl (int fd, int cmd, ...)
result = -1;
else
{
- /* Give the ports each a user ref for the new descriptor. */
- __mach_port_mod_refs (__mach_task_self (), port,
- MACH_PORT_RIGHT_SEND, 1);
- if (ctty != MACH_PORT_NULL)
- __mach_port_mod_refs (__mach_task_self (), ctty,
- MACH_PORT_RIGHT_SEND, 1);
-
- /* Install the ports and flags in the new descriptor. */
- if (ctty != MACH_PORT_NULL)
- _hurd_port_set (&new->ctty, ctty);
- new->flags = flags;
- _hurd_port_locked_set (&new->port, port); /* Unlocks NEW. */
+ /* Give the io server port a user ref for the new descriptor. */
+ err = __mach_port_mod_refs (__mach_task_self (), port,
+ MACH_PORT_RIGHT_SEND, 1);
+
+ if (err == KERN_UREFS_OVERFLOW)
+ result = __hurd_fail (EMFILE);
+ else if (err)
+ result = __hurd_fail (EINVAL);
+ else if (ctty != MACH_PORT_NULL)
+ {
+ /* We have confirmed the io server port has got a user ref
+ count, now give ctty port a user ref for the new
+ descriptor. */
+ err = __mach_port_mod_refs (__mach_task_self (), ctty,
+ MACH_PORT_RIGHT_SEND, 1);
+
+ if (err)
+ {
+ /* In this case the io server port has got a ref count
+ but the ctty port fails to get one, so we need to clean
+ the ref count we just assigned. */
+ __mach_port_mod_refs (__mach_task_self (), port,
+ MACH_PORT_RIGHT_SEND, -1);
+
+ if (err == KERN_UREFS_OVERFLOW)
+ result = __hurd_fail (EMFILE);
+ else
+ result = __hurd_fail (EINVAL);
+ }
+ }
+
+ if (!err)
+ {
+ /* The ref counts of the ports are incremented successfully. */
+ /* Install the ports and flags in the new descriptor. */
+ if (ctty != MACH_PORT_NULL)
+ _hurd_port_set (&new->ctty, ctty);
+ new->flags = flags;
+ /* Unlocks NEW. */
+ _hurd_port_locked_set (&new->port, port);
+ }
}
HURD_CRITICAL_END;
diff --git a/sysdeps/mach/hurd/futimens.c b/sysdeps/mach/hurd/futimens.c
index 30ef0a6..1212529 100644
--- a/sysdeps/mach/hurd/futimens.c
+++ b/sysdeps/mach/hurd/futimens.c
@@ -32,7 +32,9 @@ __futimens (int fd, const struct timespec tsp[2])
struct timespec atime, mtime;
error_t err;
- utime_ts_from_tspec (tsp, &atime, &mtime);
+ err = utime_ts_from_tspec (tsp, &atime, &mtime);
+ if (err)
+ return err;
err = HURD_DPORT_USE (fd, __file_utimens (port, atime, mtime));
@@ -40,7 +42,9 @@ __futimens (int fd, const struct timespec tsp[2])
{
time_value_t atim, mtim;
- utime_tvalue_from_tspec (tsp, &atim, &mtim);
+ err = utime_tvalue_from_tspec (tsp, &atim, &mtim);
+ if (err)
+ return err;
err = HURD_DPORT_USE (fd, __file_utimes (port, atim, mtim));
}
diff --git a/sysdeps/mach/hurd/futimes.c b/sysdeps/mach/hurd/futimes.c
index 20f47f3..97385d7 100644
--- a/sysdeps/mach/hurd/futimes.c
+++ b/sysdeps/mach/hurd/futimes.c
@@ -32,7 +32,9 @@ __futimes (int fd, const struct timeval tvp[2])
struct timespec atime, mtime;
error_t err;
- utime_ts_from_tval (tvp, &atime, &mtime);
+ err = utime_ts_from_tval (tvp, &atime, &mtime);
+ if (err)
+ return err;
err = HURD_DPORT_USE (fd, __file_utimens (port, atime, mtime));
@@ -40,7 +42,9 @@ __futimes (int fd, const struct timeval tvp[2])
{
time_value_t atim, mtim;
- utime_tvalue_from_tval (tvp, &atim, &mtim);
+ err = utime_tvalue_from_tval (tvp, &atim, &mtim);
+ if (err)
+ return err;
err = HURD_DPORT_USE (fd, __file_utimes (port, atim, mtim));
}
diff --git a/sysdeps/mach/hurd/getrandom-internal.h b/sysdeps/mach/hurd/getrandom-internal.h
new file mode 100644
index 0000000..8bd718b
--- /dev/null
+++ b/sysdeps/mach/hurd/getrandom-internal.h
@@ -0,0 +1,30 @@
+/* Internal definitions for Hurd getrandom implementation.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _GETRANDOM_INTERNAL_H
+#define _GETRANDOM_INTERNAL_H
+
+extern void __mach_init (void);
+
+static inline void __getrandom_early_init (_Bool initial)
+{
+ /* getrandom needs RPCs for time etc. */
+ __mach_init ();
+}
+
+#endif
diff --git a/sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c b/sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c
index 72f83ee..8961cb2 100644
--- a/sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c
+++ b/sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c
@@ -24,6 +24,8 @@
#include "pt-mutex.h"
#include <hurdlock.h>
#include <unistd.h>
+#include <shlib-compat.h>
+#include <ldsodefs.h>
int
__pthread_mutex_transfer_np (pthread_mutex_t *mtxp, pthread_t th)
@@ -73,5 +75,8 @@ __pthread_mutex_transfer_np (pthread_mutex_t *mtxp, pthread_t th)
return ret;
}
+versioned_symbol (libc, __pthread_mutex_transfer_np, pthread_mutex_transfer_np, GLIBC_2_43);
-weak_alias (__pthread_mutex_transfer_np, pthread_mutex_transfer_np)
+#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_43)
+compat_symbol (libpthread, __pthread_mutex_transfer_np, pthread_mutex_transfer_np, GLIBC_2_12);
+#endif
diff --git a/sysdeps/mach/hurd/htl/pt-sigstate-init.c b/sysdeps/mach/hurd/htl/pt-sigstate-init.c
index 5a17dd5..a0c7f27 100644
--- a/sysdeps/mach/hurd/htl/pt-sigstate-init.c
+++ b/sysdeps/mach/hurd/htl/pt-sigstate-init.c
@@ -19,6 +19,7 @@
#include <pthread.h>
#include <pt-internal.h>
#include <hurd/signal.h>
+#include <ldsodefs.h>
error_t
__pthread_sigstate_init (struct __pthread *thread)
@@ -42,3 +43,5 @@ __pthread_sigstate_init (struct __pthread *thread)
return 0;
}
+
+libc_hidden_def (__pthread_sigstate_init)
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c
index 3505d31..735dc5b 100644
--- a/sysdeps/mach/hurd/htl/pt-sysdep.c
+++ b/sysdeps/mach/hurd/htl/pt-sysdep.c
@@ -25,6 +25,7 @@
#include <pt-internal.h>
#include <pthreadP.h>
+#include <stackinfo.h>
static void
reset_pthread_total (void)
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.h b/sysdeps/mach/hurd/htl/pt-sysdep.h
index fb451e0..1b72706 100644
--- a/sysdeps/mach/hurd/htl/pt-sysdep.h
+++ b/sysdeps/mach/hurd/htl/pt-sysdep.h
@@ -69,6 +69,6 @@ __pthread_stack_dealloc (void *stackaddr, size_t stacksize)
extern int __thread_set_pcsptp (thread_t thread,
int set_pc, void *pc,
int set_sp, void *sp, int set_tp, void *tp);
-
+libc_hidden_proto (__thread_set_pcsptp)
#endif /* pt-sysdep.h */
diff --git a/sysdeps/mach/hurd/i386/bits/sigcontext.h b/sysdeps/mach/hurd/i386/bits/sigcontext.h
index 6e5e220..c44e4de 100644
--- a/sysdeps/mach/hurd/i386/bits/sigcontext.h
+++ b/sysdeps/mach/hurd/i386/bits/sigcontext.h
@@ -88,6 +88,8 @@ struct sigcontext
struct i386_fp_save sc_fpsave;
struct i386_fp_regs sc_fpregs;
int sc_fpexcsr; /* FPSR including exception bits. */
+
+ struct i386_xfloat_state *xstate;
};
/* Traditional BSD names for some members. */
diff --git a/sysdeps/mach/hurd/i386/htl/pt-machdep.c b/sysdeps/mach/hurd/i386/htl/pt-machdep.c
index fd3eb86..06c746d 100644
--- a/sysdeps/mach/hurd/i386/htl/pt-machdep.c
+++ b/sysdeps/mach/hurd/i386/htl/pt-machdep.c
@@ -23,6 +23,7 @@
#include <mach/i386/mach_i386.h>
#include <mach/mig_errors.h>
#include <mach/thread_status.h>
+#include <pt-sysdep.h>
#define HURD_TLS_DESC_DECL(desc, tcb) \
struct descriptor desc = \
@@ -80,3 +81,4 @@ __thread_set_pcsptp (thread_t thread,
return 0;
}
+libc_hidden_def (__thread_set_pcsptp)
diff --git a/sysdeps/mach/hurd/i386/htl/pt-setup.c b/sysdeps/mach/hurd/i386/htl/pt-setup.c
index c6df010..b9c41b9 100644
--- a/sysdeps/mach/hurd/i386/htl/pt-setup.c
+++ b/sysdeps/mach/hurd/i386/htl/pt-setup.c
@@ -98,3 +98,4 @@ __pthread_setup (struct __pthread *thread,
return 0;
}
+libc_hidden_def (__pthread_setup)
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index 3e183f5..b3fe424 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -28,6 +28,10 @@ GLIBC_2.11 mkostemps F
GLIBC_2.11 mkostemps64 F
GLIBC_2.11 mkstemps F
GLIBC_2.11 mkstemps64 F
+GLIBC_2.12 __pthread_get_cleanup_stack F
+GLIBC_2.12 __pthread_key_create F
+GLIBC_2.12 __pthread_kill F
+GLIBC_2.12 __pthread_mutex_transfer_np F
GLIBC_2.12 __pthread_self F
GLIBC_2.12 pthread_attr_destroy F
GLIBC_2.12 pthread_attr_getdetachstate F
@@ -56,6 +60,7 @@ GLIBC_2.12 pthread_barrierattr_destroy F
GLIBC_2.12 pthread_barrierattr_getpshared F
GLIBC_2.12 pthread_barrierattr_init F
GLIBC_2.12 pthread_barrierattr_setpshared F
+GLIBC_2.12 pthread_cancel F
GLIBC_2.12 pthread_cond_broadcast F
GLIBC_2.12 pthread_cond_destroy F
GLIBC_2.12 pthread_cond_init F
@@ -68,14 +73,25 @@ GLIBC_2.12 pthread_condattr_getpshared F
GLIBC_2.12 pthread_condattr_init F
GLIBC_2.12 pthread_condattr_setclock F
GLIBC_2.12 pthread_condattr_setpshared F
+GLIBC_2.12 pthread_detach F
GLIBC_2.12 pthread_equal F
+GLIBC_2.12 pthread_exit F
+GLIBC_2.12 pthread_getattr_np F
+GLIBC_2.12 pthread_getconcurrency F
+GLIBC_2.12 pthread_getcpuclockid F
GLIBC_2.12 pthread_getschedparam F
+GLIBC_2.12 pthread_getspecific F
+GLIBC_2.12 pthread_join F
+GLIBC_2.12 pthread_key_create F
+GLIBC_2.12 pthread_key_delete F
+GLIBC_2.12 pthread_kill F
GLIBC_2.12 pthread_mutex_destroy F
GLIBC_2.12 pthread_mutex_getprioceiling F
GLIBC_2.12 pthread_mutex_init F
GLIBC_2.12 pthread_mutex_lock F
GLIBC_2.12 pthread_mutex_setprioceiling F
GLIBC_2.12 pthread_mutex_timedlock F
+GLIBC_2.12 pthread_mutex_transfer_np F
GLIBC_2.12 pthread_mutex_trylock F
GLIBC_2.12 pthread_mutex_unlock F
GLIBC_2.12 pthread_mutexattr_destroy F
@@ -105,8 +121,23 @@ GLIBC_2.12 pthread_rwlockattr_setpshared F
GLIBC_2.12 pthread_self F
GLIBC_2.12 pthread_setcancelstate F
GLIBC_2.12 pthread_setcanceltype F
+GLIBC_2.12 pthread_setconcurrency F
GLIBC_2.12 pthread_setschedparam F
+GLIBC_2.12 pthread_setschedprio F
+GLIBC_2.12 pthread_setspecific F
GLIBC_2.12 pthread_sigmask F
+GLIBC_2.12 pthread_testcancel F
+GLIBC_2.12 pthread_yield F
+GLIBC_2.12 sem_close F
+GLIBC_2.12 sem_destroy F
+GLIBC_2.12 sem_getvalue F
+GLIBC_2.12 sem_init F
+GLIBC_2.12 sem_open F
+GLIBC_2.12 sem_post F
+GLIBC_2.12 sem_timedwait F
+GLIBC_2.12 sem_trywait F
+GLIBC_2.12 sem_unlink F
+GLIBC_2.12 sem_wait F
GLIBC_2.13 __fentry__ F
GLIBC_2.14 syncfs F
GLIBC_2.15 __fdelt_chk F
@@ -2293,6 +2324,7 @@ GLIBC_2.30 twalk_r F
GLIBC_2.32 __libc_single_threaded D 0x1
GLIBC_2.32 mach_print F
GLIBC_2.32 mremap F
+GLIBC_2.32 pthread_clockjoin_np F
GLIBC_2.32 pthread_cond_clockwait F
GLIBC_2.32 pthread_mutex_clocklock F
GLIBC_2.32 pthread_mutex_consistent F
@@ -2303,6 +2335,9 @@ GLIBC_2.32 pthread_mutexattr_setrobust F
GLIBC_2.32 pthread_mutexattr_setrobust_np F
GLIBC_2.32 pthread_rwlock_clockrdlock F
GLIBC_2.32 pthread_rwlock_clockwrlock F
+GLIBC_2.32 pthread_timedjoin_np F
+GLIBC_2.32 pthread_tryjoin_np F
+GLIBC_2.32 sem_clockwait F
GLIBC_2.32 sigabbrev_np F
GLIBC_2.32 sigdescr_np F
GLIBC_2.32 strerrordesc_np F
@@ -2586,6 +2621,11 @@ GLIBC_2.41 pthread_mutexattr_settype F
GLIBC_2.41 pthread_sigmask F
GLIBC_2.42 __inet_ntop_chk F
GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
+GLIBC_2.42 cfgetobaud F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
+GLIBC_2.42 cfsetobaud F
GLIBC_2.42 pthread_barrier_destroy F
GLIBC_2.42 pthread_barrier_init F
GLIBC_2.42 pthread_barrier_wait F
@@ -2593,6 +2633,9 @@ GLIBC_2.42 pthread_barrierattr_destroy F
GLIBC_2.42 pthread_barrierattr_getpshared F
GLIBC_2.42 pthread_barrierattr_init F
GLIBC_2.42 pthread_barrierattr_setpshared F
+GLIBC_2.42 pthread_getspecific F
+GLIBC_2.42 pthread_key_create F
+GLIBC_2.42 pthread_key_delete F
GLIBC_2.42 pthread_mutex_consistent F
GLIBC_2.42 pthread_mutex_consistent_np F
GLIBC_2.42 pthread_mutex_getprioceiling F
@@ -2614,10 +2657,37 @@ GLIBC_2.42 pthread_rwlockattr_destroy F
GLIBC_2.42 pthread_rwlockattr_getpshared F
GLIBC_2.42 pthread_rwlockattr_init F
GLIBC_2.42 pthread_rwlockattr_setpshared F
+GLIBC_2.42 pthread_setspecific F
GLIBC_2.42 uabs F
GLIBC_2.42 uimaxabs F
GLIBC_2.42 ulabs F
GLIBC_2.42 ullabs F
+GLIBC_2.43 pthread_cancel F
+GLIBC_2.43 pthread_clockjoin_np F
+GLIBC_2.43 pthread_detach F
+GLIBC_2.43 pthread_getattr_np F
+GLIBC_2.43 pthread_getconcurrency F
+GLIBC_2.43 pthread_getcpuclockid F
+GLIBC_2.43 pthread_join F
+GLIBC_2.43 pthread_kill F
+GLIBC_2.43 pthread_mutex_transfer_np F
+GLIBC_2.43 pthread_setconcurrency F
+GLIBC_2.43 pthread_setschedprio F
+GLIBC_2.43 pthread_testcancel F
+GLIBC_2.43 pthread_timedjoin_np F
+GLIBC_2.43 pthread_tryjoin_np F
+GLIBC_2.43 pthread_yield F
+GLIBC_2.43 sem_clockwait F
+GLIBC_2.43 sem_close F
+GLIBC_2.43 sem_destroy F
+GLIBC_2.43 sem_getvalue F
+GLIBC_2.43 sem_init F
+GLIBC_2.43 sem_open F
+GLIBC_2.43 sem_post F
+GLIBC_2.43 sem_timedwait F
+GLIBC_2.43 sem_trywait F
+GLIBC_2.43 sem_unlink F
+GLIBC_2.43 sem_wait F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
GLIBC_2.5 inet6_opt_find F
@@ -2683,6 +2753,8 @@ HURD_CTHREADS_0.3 __mutex_lock_solid F
HURD_CTHREADS_0.3 __mutex_trylock F
HURD_CTHREADS_0.3 __mutex_unlock F
HURD_CTHREADS_0.3 __mutex_unlock_solid F
+HURD_CTHREADS_0.3 __pthread_detach F
+HURD_CTHREADS_0.3 __pthread_getattr_np F
HURD_CTHREADS_0.3 __spin_lock F
HURD_CTHREADS_0.3 __spin_lock_init F
HURD_CTHREADS_0.3 __spin_lock_solid F
diff --git a/sysdeps/mach/hurd/i386/libm.abilist b/sysdeps/mach/hurd/i386/libm.abilist
index 8d76dd8..47d215f 100644
--- a/sysdeps/mach/hurd/i386/libm.abilist
+++ b/sysdeps/mach/hurd/i386/libm.abilist
@@ -1277,6 +1277,14 @@ GLIBC_2.41 tanpif32x F
GLIBC_2.41 tanpif64 F
GLIBC_2.41 tanpif64x F
GLIBC_2.41 tanpil F
+GLIBC_2.42 compoundn F
+GLIBC_2.42 compoundnf F
+GLIBC_2.42 compoundnf128 F
+GLIBC_2.42 compoundnf32 F
+GLIBC_2.42 compoundnf32x F
+GLIBC_2.42 compoundnf64 F
+GLIBC_2.42 compoundnf64x F
+GLIBC_2.42 compoundnl F
GLIBC_2.42 pown F
GLIBC_2.42 pownf F
GLIBC_2.42 pownf128 F
@@ -1293,6 +1301,14 @@ GLIBC_2.42 powrf32x F
GLIBC_2.42 powrf64 F
GLIBC_2.42 powrf64x F
GLIBC_2.42 powrl F
+GLIBC_2.42 rootn F
+GLIBC_2.42 rootnf F
+GLIBC_2.42 rootnf128 F
+GLIBC_2.42 rootnf32 F
+GLIBC_2.42 rootnf32x F
+GLIBC_2.42 rootnf64 F
+GLIBC_2.42 rootnf64x F
+GLIBC_2.42 rootnl F
GLIBC_2.42 rsqrt F
GLIBC_2.42 rsqrtf F
GLIBC_2.42 rsqrtf128 F
diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
index b067d37..a05cacf 100644
--- a/sysdeps/mach/hurd/i386/libpthread.abilist
+++ b/sysdeps/mach/hurd/i386/libpthread.abilist
@@ -1,9 +1,5 @@
GLIBC_2.12 __mutex_lock_solid F
GLIBC_2.12 __mutex_unlock_solid F
-GLIBC_2.12 __pthread_get_cleanup_stack F
-GLIBC_2.12 __pthread_key_create F
-GLIBC_2.12 __pthread_kill F
-GLIBC_2.12 __pthread_mutex_transfer_np F
GLIBC_2.12 __pthread_spin_destroy F
GLIBC_2.12 __pthread_spin_init F
GLIBC_2.12 __pthread_spin_lock F
@@ -22,39 +18,12 @@ GLIBC_2.12 flockfile F
GLIBC_2.12 ftrylockfile F
GLIBC_2.12 funlockfile F
GLIBC_2.12 pthread_atfork F
-GLIBC_2.12 pthread_cancel F
GLIBC_2.12 pthread_create F
-GLIBC_2.12 pthread_detach F
-GLIBC_2.12 pthread_exit F
-GLIBC_2.12 pthread_getattr_np F
-GLIBC_2.12 pthread_getconcurrency F
-GLIBC_2.12 pthread_getcpuclockid F
-GLIBC_2.12 pthread_getspecific F
-GLIBC_2.12 pthread_join F
-GLIBC_2.12 pthread_key_create F
-GLIBC_2.12 pthread_key_delete F
-GLIBC_2.12 pthread_kill F
-GLIBC_2.12 pthread_mutex_transfer_np F
-GLIBC_2.12 pthread_setconcurrency F
-GLIBC_2.12 pthread_setschedprio F
-GLIBC_2.12 pthread_setspecific F
GLIBC_2.12 pthread_spin_destroy F
GLIBC_2.12 pthread_spin_init F
GLIBC_2.12 pthread_spin_lock F
GLIBC_2.12 pthread_spin_trylock F
GLIBC_2.12 pthread_spin_unlock F
-GLIBC_2.12 pthread_testcancel F
-GLIBC_2.12 pthread_yield F
-GLIBC_2.12 sem_close F
-GLIBC_2.12 sem_destroy F
-GLIBC_2.12 sem_getvalue F
-GLIBC_2.12 sem_init F
-GLIBC_2.12 sem_open F
-GLIBC_2.12 sem_post F
-GLIBC_2.12 sem_timedwait F
-GLIBC_2.12 sem_trywait F
-GLIBC_2.12 sem_unlink F
-GLIBC_2.12 sem_wait F
GLIBC_2.2.6 _IO_flockfile F
GLIBC_2.2.6 _IO_ftrylockfile F
GLIBC_2.2.6 _IO_funlockfile F
@@ -75,10 +44,6 @@ GLIBC_2.32 mtx_lock F
GLIBC_2.32 mtx_timedlock F
GLIBC_2.32 mtx_trylock F
GLIBC_2.32 mtx_unlock F
-GLIBC_2.32 pthread_clockjoin_np F
-GLIBC_2.32 pthread_timedjoin_np F
-GLIBC_2.32 pthread_tryjoin_np F
-GLIBC_2.32 sem_clockwait F
GLIBC_2.32 thrd_create F
GLIBC_2.32 thrd_detach F
GLIBC_2.32 thrd_exit F
diff --git a/sysdeps/mach/hurd/i386/sigreturn.c b/sysdeps/mach/hurd/i386/sigreturn.c
index ce8df8d..dc57d61 100644
--- a/sysdeps/mach/hurd/i386/sigreturn.c
+++ b/sysdeps/mach/hurd/i386/sigreturn.c
@@ -21,6 +21,8 @@
#include <stdlib.h>
#include <string.h>
+#include <cpuid.h>
+
/* This is run on the thread stack after restoring it, to be able to
unlock SS off sigstack. */
static void
@@ -123,10 +125,35 @@ __sigreturn (struct sigcontext *scp)
if (scp->sc_onstack)
ss->sigaltstack.ss_flags &= ~SS_ONSTACK;
- if (scp->sc_fpused)
- /* Restore the FPU state. Mach conveniently stores the state
- in the format the i387 `frstor' instruction uses to restore it. */
- asm volatile ("frstor %0" : : "m" (scp->sc_fpsave));
+#ifdef i386_XFLOAT_STATE
+ if (scp->xstate)
+ {
+ if (scp->xstate->initialized)
+ {
+ unsigned eax, ebx, ecx, edx;
+ __cpuid_count(0xd, 0, eax, ebx, ecx, edx);
+ switch (scp->xstate->fp_save_kind)
+ {
+ case 0: // FNSAVE
+ asm volatile("frstor %0" : : "m" (scp->xstate->hw_state));
+ break;
+ case 1: // FXSAVE
+ asm volatile("fxrstor %0" : : "m" (scp->xstate->hw_state), \
+ "a" (eax), "d" (edx));
+ break;
+ default: // XSAVE, XSAVEOPT, XSAVEC, XSAVES
+ asm volatile("xrstor %0" : : "m" (scp->xstate->hw_state), \
+ "a" (eax), "d" (edx));
+ break;
+ }
+ }
+ }
+ else
+#endif
+ if (scp->sc_fpused)
+ /* Restore the FPU state. Mach conveniently stores the state
+ in the format the i387 `frstor' instruction uses to restore it. */
+ asm volatile ("frstor %0" : : "m" (scp->sc_fpsave));
{
/* There are convenient instructions to pop state off the stack, so we
diff --git a/sysdeps/mach/hurd/renameat2.c b/sysdeps/mach/hurd/renameat2.c
index 59a4e31..5b09fed 100644
--- a/sysdeps/mach/hurd/renameat2.c
+++ b/sysdeps/mach/hurd/renameat2.c
@@ -37,15 +37,28 @@ __renameat2 (int oldfd, const char *old, int newfd, const char *new,
if (flags & RENAME_NOREPLACE)
excl = 1;
- olddir = __directory_name_split_at (oldfd, old, (char **) &oldname);
+ olddir = __file_name_split_at (oldfd, old, (char **) &oldname);
if (olddir == MACH_PORT_NULL)
return -1;
- newdir = __directory_name_split_at (newfd, new, (char **) &newname);
+ if (!*oldname)
+ {
+ /* Trailing slash. */
+ __mach_port_deallocate (__mach_task_self (), olddir);
+ return __hurd_fail (ENOTDIR);
+ }
+ newdir = __file_name_split_at (newfd, new, (char **) &newname);
if (newdir == MACH_PORT_NULL)
{
- __mach_port_deallocate (__mach_task_self (), olddir);
+ __mach_port_deallocate (__mach_task_self (), olddir);
return -1;
}
+ if (!*newname)
+ {
+ /* Trailing slash. */
+ __mach_port_deallocate (__mach_task_self (), olddir);
+ __mach_port_deallocate (__mach_task_self (), newdir);
+ return __hurd_fail (ENOTDIR);
+ }
err = __dir_rename (olddir, oldname, newdir, newname, excl);
__mach_port_deallocate (__mach_task_self (), olddir);
diff --git a/sysdeps/mach/hurd/symlinkat.c b/sysdeps/mach/hurd/symlinkat.c
index e7dfb67..cb6250e 100644
--- a/sysdeps/mach/hurd/symlinkat.c
+++ b/sysdeps/mach/hurd/symlinkat.c
@@ -47,7 +47,7 @@ __symlinkat (const char *from, int fd, const char *to)
if (! *name)
/* Can't link to the existing directory itself. */
- err = ENOTDIR;
+ err = EEXIST;
else
/* Create a new, unlinked node in the target directory. */
err = __dir_mkfile (dir, O_WRITE, 0777 & ~_hurd_umask, &node);
diff --git a/sysdeps/mach/hurd/utime-helper.c b/sysdeps/mach/hurd/utime-helper.c
index d88bccd..6afa871 100644
--- a/sysdeps/mach/hurd/utime-helper.c
+++ b/sysdeps/mach/hurd/utime-helper.c
@@ -21,8 +21,14 @@
#include <stddef.h>
#include <sys/time.h>
+static inline bool
+check_tval (const struct timeval *tvp)
+{
+ return tvp->tv_usec >= 0 && tvp->tv_usec < USEC_PER_SEC;
+}
+
/* Initializes atime/mtime timespec structures from an array of timeval. */
-static inline void
+static inline error_t
utime_ts_from_tval (const struct timeval tvp[2],
struct timespec *atime, struct timespec *mtime)
{
@@ -37,13 +43,19 @@ utime_ts_from_tval (const struct timeval tvp[2],
}
else
{
+ if (!check_tval (&tvp[0]))
+ return EINVAL;
+ if (!check_tval (&tvp[1]))
+ return EINVAL;
+
TIMEVAL_TO_TIMESPEC (&tvp[0], atime);
TIMEVAL_TO_TIMESPEC (&tvp[1], mtime);
}
+ return 0;
}
/* Initializes atime/mtime time_value_t structures from an array of timeval. */
-static inline void
+static inline error_t
utime_tvalue_from_tval (const struct timeval tvp[2],
time_value_t *atime, time_value_t *mtime)
{
@@ -53,11 +65,17 @@ utime_tvalue_from_tval (const struct timeval tvp[2],
atime->microseconds = mtime->microseconds = -1;
else
{
+ if (!check_tval (&tvp[0]))
+ return EINVAL;
+ if (!check_tval (&tvp[1]))
+ return EINVAL;
+
atime->seconds = tvp[0].tv_sec;
atime->microseconds = tvp[0].tv_usec;
mtime->seconds = tvp[1].tv_sec;
mtime->microseconds = tvp[1].tv_usec;
}
+ return 0;
}
/* Changes the access time of the file behind PORT using a timeval array. */
@@ -67,7 +85,9 @@ hurd_futimes (const file_t port, const struct timeval tvp[2])
error_t err;
struct timespec atime, mtime;
- utime_ts_from_tval (tvp, &atime, &mtime);
+ err = utime_ts_from_tval (tvp, &atime, &mtime);
+ if (err)
+ return err;
err = __file_utimens (port, atime, mtime);
@@ -75,7 +95,9 @@ hurd_futimes (const file_t port, const struct timeval tvp[2])
{
time_value_t atim, mtim;
- utime_tvalue_from_tval (tvp, &atim, &mtim);
+ err = utime_tvalue_from_tval (tvp, &atim, &mtim);
+ if (err)
+ return err;
err = __file_utimes (port, atim, mtim);
}
@@ -83,8 +105,16 @@ hurd_futimes (const file_t port, const struct timeval tvp[2])
return err;
}
+static inline bool
+check_tspec (const struct timespec *tsp)
+{
+ return tsp->tv_nsec == UTIME_NOW
+ || tsp->tv_nsec == UTIME_OMIT
+ || tsp->tv_nsec >= 0 && tsp->tv_nsec < NSEC_PER_SEC;
+}
+
/* Initializes atime/mtime timespec structures from an array of timespec. */
-static inline void
+static inline error_t
utime_ts_from_tspec (const struct timespec tsp[2],
struct timespec *atime, struct timespec *mtime)
{
@@ -99,13 +129,19 @@ utime_ts_from_tspec (const struct timespec tsp[2],
}
else
{
+ if (!check_tspec (&tsp[0]))
+ return EINVAL;
+ if (!check_tspec (&tsp[1]))
+ return EINVAL;
+
*atime = tsp[0];
*mtime = tsp[1];
}
+ return 0;
}
/* Initializes atime/mtime time_value_t structures from an array of timespec. */
-static inline void
+static inline error_t
utime_tvalue_from_tspec (const struct timespec tsp[2],
time_value_t *atime, time_value_t *mtime)
{
@@ -115,6 +151,11 @@ utime_tvalue_from_tspec (const struct timespec tsp[2],
atime->microseconds = mtime->microseconds = -1;
else
{
+ if (!check_tspec (&tsp[0]))
+ return EINVAL;
+ if (!check_tspec (&tsp[1]))
+ return EINVAL;
+
if (tsp[0].tv_nsec == UTIME_NOW)
atime->microseconds = -1;
else if (tsp[0].tv_nsec == UTIME_OMIT)
@@ -128,6 +169,7 @@ utime_tvalue_from_tspec (const struct timespec tsp[2],
else
TIMESPEC_TO_TIME_VALUE (mtime, &(tsp[1]));
}
+ return 0;
}
/* Changes the access time of the file behind PORT using a timespec array. */
@@ -137,7 +179,9 @@ hurd_futimens (const file_t port, const struct timespec tsp[2])
error_t err;
struct timespec atime, mtime;
- utime_ts_from_tspec (tsp, &atime, &mtime);
+ err = utime_ts_from_tspec (tsp, &atime, &mtime);
+ if (err)
+ return err;
err = __file_utimens (port, atime, mtime);
@@ -145,7 +189,9 @@ hurd_futimens (const file_t port, const struct timespec tsp[2])
{
time_value_t atim, mtim;
- utime_tvalue_from_tspec (tsp, &atim, &mtim);
+ err = utime_tvalue_from_tspec (tsp, &atim, &mtim);
+ if (err)
+ return err;
err = __file_utimes (port, atim, mtim);
}
diff --git a/sysdeps/mach/hurd/x86/trampoline.c b/sysdeps/mach/hurd/x86/trampoline.c
index 8e2890f..6f23c56 100644
--- a/sysdeps/mach/hurd/x86/trampoline.c
+++ b/sysdeps/mach/hurd/x86/trampoline.c
@@ -26,7 +26,11 @@
#include "hurdfault.h"
#include <intr-msg.h>
#include <sys/ucontext.h>
-
+#ifdef __x86_64__
+#include <mach/x86_64/mach_i386.h>
+#else
+#include <mach/i386/mach_i386.h>
+#endif
/* Fill in a siginfo_t structure for SA_SIGINFO-enabled handlers. */
static void fill_siginfo (siginfo_t *si, int signo,
@@ -106,6 +110,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action
void firewall (void);
void *sigsp;
struct sigcontext *scp;
+ vm_size_t xstate_size;
struct
{
union
@@ -145,6 +150,14 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action
struct hurd_userlink link;
ucontext_t ucontext;
siginfo_t siginfo;
+#ifdef __x86_64__
+ char _pad2[56];
+#else
+ char _pad2[20];
+#endif
+ char xstate[];
+ /* Don't add anything after xstate, as it's dynamically
+ sized. */
} *stackframe;
#ifdef __x86_64__
@@ -170,6 +183,17 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action
if (! machine_get_basic_state (ss->thread, state))
return NULL;
+ /* Initialize the size of the CPU extended state, to be saved during
+ * signal handling */
+#ifdef i386_XFLOAT_STATE
+ _Static_assert ((sizeof(*stackframe) + sizeof(struct i386_xfloat_state)) % 64 == 0,
+ "stackframe size must be multiple of 64-byte minus "
+ "sizeof(struct i386_xfloat_state), please adjust _pad2");
+
+ if (__i386_get_xstate_size(__mach_host_self(), &xstate_size))
+#endif
+ xstate_size = 0;
+
/* Save the original SP in the gratuitous `esp' slot.
We may need to reset the SP (the `uesp' slot) to avoid clobbering an
interrupted RPC frame. */
@@ -196,14 +220,21 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action
#endif
}
- /* Push the arguments to call `trampoline' on the stack. */
- sigsp -= sizeof (*stackframe);
-#ifdef __x86_64__
- /* Align SP at 16 bytes. Coupled with the fact that sigreturn_addr is
- 16-byte aligned within the stackframe struct, this ensures that it ends
- up on a 16-byte aligned address, as required by the ABI. */
- sigsp = (void *) ((uintptr_t) sigsp & ~15UL);
-#endif
+ /* Push the arguments to call `trampoline' on the stack.
+ * The extended state might have a variable size depending on the platform,
+ * so we dynamically allocate it on the stack frame.*/
+ sigsp -= sizeof (*stackframe) + xstate_size;
+
+ /* Align SP at 64 bytes. This is needed for two reasons:
+ * - sigreturn_addr is 16-byte aligned within the stackframe
+ * struct, and this ensures that it ends up on a 16-byte aligned
+ * address, as required by the ABI.
+ * - the XSAVE state needs to be aligned at 64 bytes (on both i386 and
+ * x86_64), so we align the stackframe also at 64 bytes and add the
+ * required padding at the end, see the _pad2 field.
+ */
+ sigsp = (void *) ((uintptr_t) sigsp & ~63UL);
+
stackframe = sigsp;
if (_hurdsig_catch_memory_fault (stackframe))
@@ -248,14 +279,40 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action
memcpy (&scp->sc_i386_thread_state,
&state->basic, sizeof (state->basic));
- /* struct sigcontext is laid out so that starting at sc_fpkind mimics
- a struct i386_float_state. */
- _Static_assert (offsetof (struct sigcontext, sc_i386_float_state)
- % __alignof__ (struct i386_float_state) == 0,
- "sc_i386_float_state layout mismatch");
- ok = machine_get_state (ss->thread, state, i386_FLOAT_STATE,
- &state->fpu, &scp->sc_i386_float_state,
- sizeof (state->fpu));
+ scp->xstate = NULL;
+#ifdef i386_XFLOAT_STATE
+ if (xstate_size > 0)
+ {
+ mach_msg_type_number_t got = (xstate_size / sizeof (int));
+
+ ok = (! __thread_get_state (ss->thread, i386_XFLOAT_STATE,
+ (thread_state_t) stackframe->xstate, &got)
+ && got == (xstate_size / sizeof (int)));
+
+ if (ok && ((struct i386_xfloat_state*) stackframe->xstate)->fp_save_kind > 5)
+ /* We support up to XSAVES */
+ ok = 0;
+
+ if (ok)
+ {
+ scp->xstate = (struct i386_xfloat_state*) stackframe->xstate;
+ assert((uintptr_t)scp->xstate->hw_state % 64 == 0);
+ }
+ }
+ else
+#endif
+ ok = 0;
+ if (!ok)
+ {
+ /* struct sigcontext is laid out so that starting at sc_fpkind mimics
+ a struct i386_float_state. */
+ _Static_assert (offsetof (struct sigcontext, sc_i386_float_state)
+ % __alignof__ (struct i386_float_state) == 0,
+ "sc_i386_float_state layout mismatch");
+ ok = machine_get_state (ss->thread, state, i386_FLOAT_STATE,
+ &state->fpu, &scp->sc_i386_float_state,
+ sizeof (state->fpu));
+ }
/* Set up the arguments for the signal handler. */
stackframe->signo = signo;
@@ -404,7 +461,10 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action
- in gdb: gdb/i386-gnu-tdep.c gnu_sigtramp_code. */
#ifdef __x86_64__
-asm ("rpc_wait_trampoline:\n"
+asm ("trampoline:\n"
+ "fnclex\n" /* Clear any pending exception. */
+ "jmp _trampoline\n"
+ "rpc_wait_trampoline:\n"
/* This is the entry point when we have an RPC reply message to receive
before running the handler. The MACH_MSG_SEND bit has already been
cleared in the OPTION argument in our %rsi. The interrupted user
@@ -423,7 +483,7 @@ asm ("rpc_wait_trampoline:\n"
/* Switch to the signal stack. */
"movq %rbx, %rsp\n"
- "trampoline:\n"
+ "_trampoline:\n"
/* Entry point for running the handler normally. The arguments to the
handler function are on the top of the stack, same as in the i386
version:
@@ -449,7 +509,10 @@ asm ("rpc_wait_trampoline:\n"
"movq 16(%rsp), %rdi\n"
"ret");
#else
-asm ("rpc_wait_trampoline:\n");
+asm ("trampoline:\n"
+ "fnclex\n" /* Clear any pending exception. */
+ "jmp _trampoline\n"
+ "rpc_wait_trampoline:\n");
/* This is the entry point when we have an RPC reply message to receive
before running the handler. The MACH_MSG_SEND bit has already been
cleared in the OPTION argument on our stack. The interrupted user
@@ -469,7 +532,7 @@ asm (/* Retry the interrupted mach_msg system call. */
/* Switch to the signal stack. */
"movl %ebx, %esp\n");
- asm ("trampoline:\n");
+asm ("_trampoline:\n");
/* Entry point for running the handler normally. The arguments to the
handler function are already on the top of the stack:
diff --git a/sysdeps/mach/hurd/x86_64/bits/sigcontext.h b/sysdeps/mach/hurd/x86_64/bits/sigcontext.h
index 7bac881..d83795f 100644
--- a/sysdeps/mach/hurd/x86_64/bits/sigcontext.h
+++ b/sysdeps/mach/hurd/x86_64/bits/sigcontext.h
@@ -96,6 +96,8 @@ struct sigcontext
struct i386_fp_save sc_fpsave;
struct i386_fp_regs sc_fpregs;
int sc_fpexcsr; /* FPSR including exception bits. */
+
+ struct i386_xfloat_state *xstate;
};
/* Traditional BSD names for some members. */
diff --git a/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c b/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c
index 9281545..f3e3d0a 100644
--- a/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c
+++ b/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c
@@ -24,6 +24,7 @@
#include <mach/x86_64/mach_i386.h>
#include <mach/mig_errors.h>
#include <mach/thread_status.h>
+#include <pt-sysdep.h>
int
__thread_set_pcsptp (thread_t thread,
@@ -71,3 +72,4 @@ __thread_set_pcsptp (thread_t thread,
return 0;
}
+libc_hidden_def (__thread_set_pcsptp)
diff --git a/sysdeps/mach/hurd/x86_64/htl/pt-setup.c b/sysdeps/mach/hurd/x86_64/htl/pt-setup.c
index 76a4394..88c39b7 100644
--- a/sysdeps/mach/hurd/x86_64/htl/pt-setup.c
+++ b/sysdeps/mach/hurd/x86_64/htl/pt-setup.c
@@ -91,3 +91,4 @@ __pthread_setup (struct __pthread *thread,
return 0;
}
+libc_hidden_def (__pthread_setup)
diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist
index 688ee26..56da3c5 100644
--- a/sysdeps/mach/hurd/x86_64/libc.abilist
+++ b/sysdeps/mach/hurd/x86_64/libc.abilist
@@ -392,6 +392,9 @@ GLIBC_2.38 __profile_frequency F
GLIBC_2.38 __progname D 0x8
GLIBC_2.38 __progname_full D 0x8
GLIBC_2.38 __pthread_get_cleanup_stack F
+GLIBC_2.38 __pthread_key_create F
+GLIBC_2.38 __pthread_kill F
+GLIBC_2.38 __pthread_mutex_transfer_np F
GLIBC_2.38 __pthread_self F
GLIBC_2.38 __ptsname_r_chk F
GLIBC_2.38 __pwrite64 F
@@ -1538,6 +1541,8 @@ GLIBC_2.38 pthread_barrierattr_destroy F
GLIBC_2.38 pthread_barrierattr_getpshared F
GLIBC_2.38 pthread_barrierattr_init F
GLIBC_2.38 pthread_barrierattr_setpshared F
+GLIBC_2.38 pthread_cancel F
+GLIBC_2.38 pthread_clockjoin_np F
GLIBC_2.38 pthread_cond_broadcast F
GLIBC_2.38 pthread_cond_clockwait F
GLIBC_2.38 pthread_cond_destroy F
@@ -1551,9 +1556,18 @@ GLIBC_2.38 pthread_condattr_getpshared F
GLIBC_2.38 pthread_condattr_init F
GLIBC_2.38 pthread_condattr_setclock F
GLIBC_2.38 pthread_condattr_setpshared F
+GLIBC_2.38 pthread_detach F
GLIBC_2.38 pthread_equal F
GLIBC_2.38 pthread_exit F
+GLIBC_2.38 pthread_getattr_np F
+GLIBC_2.38 pthread_getconcurrency F
+GLIBC_2.38 pthread_getcpuclockid F
GLIBC_2.38 pthread_getschedparam F
+GLIBC_2.38 pthread_getspecific F
+GLIBC_2.38 pthread_join F
+GLIBC_2.38 pthread_key_create F
+GLIBC_2.38 pthread_key_delete F
+GLIBC_2.38 pthread_kill F
GLIBC_2.38 pthread_mutex_clocklock F
GLIBC_2.38 pthread_mutex_consistent F
GLIBC_2.38 pthread_mutex_consistent_np F
@@ -1563,6 +1577,7 @@ GLIBC_2.38 pthread_mutex_init F
GLIBC_2.38 pthread_mutex_lock F
GLIBC_2.38 pthread_mutex_setprioceiling F
GLIBC_2.38 pthread_mutex_timedlock F
+GLIBC_2.38 pthread_mutex_transfer_np F
GLIBC_2.38 pthread_mutex_trylock F
GLIBC_2.38 pthread_mutex_unlock F
GLIBC_2.38 pthread_mutexattr_destroy F
@@ -1598,8 +1613,15 @@ GLIBC_2.38 pthread_rwlockattr_setpshared F
GLIBC_2.38 pthread_self F
GLIBC_2.38 pthread_setcancelstate F
GLIBC_2.38 pthread_setcanceltype F
+GLIBC_2.38 pthread_setconcurrency F
GLIBC_2.38 pthread_setschedparam F
+GLIBC_2.38 pthread_setschedprio F
+GLIBC_2.38 pthread_setspecific F
GLIBC_2.38 pthread_sigmask F
+GLIBC_2.38 pthread_testcancel F
+GLIBC_2.38 pthread_timedjoin_np F
+GLIBC_2.38 pthread_tryjoin_np F
+GLIBC_2.38 pthread_yield F
GLIBC_2.38 ptrace F
GLIBC_2.38 ptsname F
GLIBC_2.38 ptsname_r F
@@ -1737,6 +1759,17 @@ GLIBC_2.38 seed48 F
GLIBC_2.38 seed48_r F
GLIBC_2.38 seekdir F
GLIBC_2.38 select F
+GLIBC_2.38 sem_clockwait F
+GLIBC_2.38 sem_close F
+GLIBC_2.38 sem_destroy F
+GLIBC_2.38 sem_getvalue F
+GLIBC_2.38 sem_init F
+GLIBC_2.38 sem_open F
+GLIBC_2.38 sem_post F
+GLIBC_2.38 sem_timedwait F
+GLIBC_2.38 sem_trywait F
+GLIBC_2.38 sem_unlink F
+GLIBC_2.38 sem_wait F
GLIBC_2.38 semctl F
GLIBC_2.38 semget F
GLIBC_2.38 semop F
@@ -2269,6 +2302,11 @@ GLIBC_2.41 pthread_mutexattr_settype F
GLIBC_2.41 pthread_sigmask F
GLIBC_2.42 __inet_ntop_chk F
GLIBC_2.42 __inet_pton_chk F
+GLIBC_2.42 cfgetibaud F
+GLIBC_2.42 cfgetobaud F
+GLIBC_2.42 cfsetbaud F
+GLIBC_2.42 cfsetibaud F
+GLIBC_2.42 cfsetobaud F
GLIBC_2.42 pthread_barrier_destroy F
GLIBC_2.42 pthread_barrier_init F
GLIBC_2.42 pthread_barrier_wait F
@@ -2276,6 +2314,9 @@ GLIBC_2.42 pthread_barrierattr_destroy F
GLIBC_2.42 pthread_barrierattr_getpshared F
GLIBC_2.42 pthread_barrierattr_init F
GLIBC_2.42 pthread_barrierattr_setpshared F
+GLIBC_2.42 pthread_getspecific F
+GLIBC_2.42 pthread_key_create F
+GLIBC_2.42 pthread_key_delete F
GLIBC_2.42 pthread_mutex_consistent F
GLIBC_2.42 pthread_mutex_consistent_np F
GLIBC_2.42 pthread_mutex_getprioceiling F
@@ -2297,10 +2338,37 @@ GLIBC_2.42 pthread_rwlockattr_destroy F
GLIBC_2.42 pthread_rwlockattr_getpshared F
GLIBC_2.42 pthread_rwlockattr_init F
GLIBC_2.42 pthread_rwlockattr_setpshared F
+GLIBC_2.42 pthread_setspecific F
GLIBC_2.42 uabs F
GLIBC_2.42 uimaxabs F
GLIBC_2.42 ulabs F
GLIBC_2.42 ullabs F
+GLIBC_2.43 pthread_cancel F
+GLIBC_2.43 pthread_clockjoin_np F
+GLIBC_2.43 pthread_detach F
+GLIBC_2.43 pthread_getattr_np F
+GLIBC_2.43 pthread_getconcurrency F
+GLIBC_2.43 pthread_getcpuclockid F
+GLIBC_2.43 pthread_join F
+GLIBC_2.43 pthread_kill F
+GLIBC_2.43 pthread_mutex_transfer_np F
+GLIBC_2.43 pthread_setconcurrency F
+GLIBC_2.43 pthread_setschedprio F
+GLIBC_2.43 pthread_testcancel F
+GLIBC_2.43 pthread_timedjoin_np F
+GLIBC_2.43 pthread_tryjoin_np F
+GLIBC_2.43 pthread_yield F
+GLIBC_2.43 sem_clockwait F
+GLIBC_2.43 sem_close F
+GLIBC_2.43 sem_destroy F
+GLIBC_2.43 sem_getvalue F
+GLIBC_2.43 sem_init F
+GLIBC_2.43 sem_open F
+GLIBC_2.43 sem_post F
+GLIBC_2.43 sem_timedwait F
+GLIBC_2.43 sem_trywait F
+GLIBC_2.43 sem_unlink F
+GLIBC_2.43 sem_wait F
HURD_CTHREADS_0.3 __cthread_getspecific F
HURD_CTHREADS_0.3 __cthread_keycreate F
HURD_CTHREADS_0.3 __cthread_setspecific F
@@ -2310,6 +2378,8 @@ HURD_CTHREADS_0.3 __mutex_lock_solid F
HURD_CTHREADS_0.3 __mutex_trylock F
HURD_CTHREADS_0.3 __mutex_unlock F
HURD_CTHREADS_0.3 __mutex_unlock_solid F
+HURD_CTHREADS_0.3 __pthread_detach F
+HURD_CTHREADS_0.3 __pthread_getattr_np F
HURD_CTHREADS_0.3 __spin_lock F
HURD_CTHREADS_0.3 __spin_lock_init F
HURD_CTHREADS_0.3 __spin_lock_solid F
diff --git a/sysdeps/mach/hurd/x86_64/libm.abilist b/sysdeps/mach/hurd/x86_64/libm.abilist
index 12ae364..52c9d56 100644
--- a/sysdeps/mach/hurd/x86_64/libm.abilist
+++ b/sysdeps/mach/hurd/x86_64/libm.abilist
@@ -1134,6 +1134,14 @@ GLIBC_2.41 tanpif32x F
GLIBC_2.41 tanpif64 F
GLIBC_2.41 tanpif64x F
GLIBC_2.41 tanpil F
+GLIBC_2.42 compoundn F
+GLIBC_2.42 compoundnf F
+GLIBC_2.42 compoundnf128 F
+GLIBC_2.42 compoundnf32 F
+GLIBC_2.42 compoundnf32x F
+GLIBC_2.42 compoundnf64 F
+GLIBC_2.42 compoundnf64x F
+GLIBC_2.42 compoundnl F
GLIBC_2.42 pown F
GLIBC_2.42 pownf F
GLIBC_2.42 pownf128 F
@@ -1150,6 +1158,14 @@ GLIBC_2.42 powrf32x F
GLIBC_2.42 powrf64 F
GLIBC_2.42 powrf64x F
GLIBC_2.42 powrl F
+GLIBC_2.42 rootn F
+GLIBC_2.42 rootnf F
+GLIBC_2.42 rootnf128 F
+GLIBC_2.42 rootnf32 F
+GLIBC_2.42 rootnf32x F
+GLIBC_2.42 rootnf64 F
+GLIBC_2.42 rootnf64x F
+GLIBC_2.42 rootnl F
GLIBC_2.42 rsqrt F
GLIBC_2.42 rsqrtf F
GLIBC_2.42 rsqrtf128 F
diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist
index 6b8acec..0b1dcf1 100644
--- a/sysdeps/mach/hurd/x86_64/libpthread.abilist
+++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist
@@ -5,10 +5,6 @@ GLIBC_2.38 __errno_location F
GLIBC_2.38 __h_errno_location F
GLIBC_2.38 __mutex_lock_solid F
GLIBC_2.38 __mutex_unlock_solid F
-GLIBC_2.38 __pthread_get_cleanup_stack F
-GLIBC_2.38 __pthread_key_create F
-GLIBC_2.38 __pthread_kill F
-GLIBC_2.38 __pthread_mutex_transfer_np F
GLIBC_2.38 __pthread_spin_destroy F
GLIBC_2.38 __pthread_spin_init F
GLIBC_2.38 __pthread_spin_lock F
@@ -39,45 +35,14 @@ GLIBC_2.38 mtx_lock F
GLIBC_2.38 mtx_timedlock F
GLIBC_2.38 mtx_trylock F
GLIBC_2.38 mtx_unlock F
-GLIBC_2.38 pthread_cancel F
-GLIBC_2.38 pthread_clockjoin_np F
GLIBC_2.38 pthread_create F
-GLIBC_2.38 pthread_detach F
-GLIBC_2.38 pthread_exit F
-GLIBC_2.38 pthread_getattr_np F
-GLIBC_2.38 pthread_getconcurrency F
-GLIBC_2.38 pthread_getcpuclockid F
-GLIBC_2.38 pthread_getspecific F
GLIBC_2.38 pthread_hurd_cond_timedwait_np F
GLIBC_2.38 pthread_hurd_cond_wait_np F
-GLIBC_2.38 pthread_join F
-GLIBC_2.38 pthread_key_create F
-GLIBC_2.38 pthread_key_delete F
-GLIBC_2.38 pthread_kill F
-GLIBC_2.38 pthread_mutex_transfer_np F
-GLIBC_2.38 pthread_setconcurrency F
-GLIBC_2.38 pthread_setschedprio F
-GLIBC_2.38 pthread_setspecific F
GLIBC_2.38 pthread_spin_destroy F
GLIBC_2.38 pthread_spin_init F
GLIBC_2.38 pthread_spin_lock F
GLIBC_2.38 pthread_spin_trylock F
GLIBC_2.38 pthread_spin_unlock F
-GLIBC_2.38 pthread_testcancel F
-GLIBC_2.38 pthread_timedjoin_np F
-GLIBC_2.38 pthread_tryjoin_np F
-GLIBC_2.38 pthread_yield F
-GLIBC_2.38 sem_clockwait F
-GLIBC_2.38 sem_close F
-GLIBC_2.38 sem_destroy F
-GLIBC_2.38 sem_getvalue F
-GLIBC_2.38 sem_init F
-GLIBC_2.38 sem_open F
-GLIBC_2.38 sem_post F
-GLIBC_2.38 sem_timedwait F
-GLIBC_2.38 sem_trywait F
-GLIBC_2.38 sem_unlink F
-GLIBC_2.38 sem_wait F
GLIBC_2.38 thrd_create F
GLIBC_2.38 thrd_detach F
GLIBC_2.38 thrd_exit F
diff --git a/sysdeps/mach/hurd/x86_64/sigreturn.c b/sysdeps/mach/hurd/x86_64/sigreturn.c
index 81a2d3b..773c00f 100644
--- a/sysdeps/mach/hurd/x86_64/sigreturn.c
+++ b/sysdeps/mach/hurd/x86_64/sigreturn.c
@@ -20,6 +20,8 @@
#include <hurd/msg.h>
#include <stdlib.h>
+#include <cpuid.h>
+
/* This is run on the thread stack after restoring it, to be able to
unlock SS off sigstack. */
void
@@ -116,10 +118,35 @@ __sigreturn (struct sigcontext *scp)
if (scp->sc_onstack)
ss->sigaltstack.ss_flags &= ~SS_ONSTACK;
- if (scp->sc_fpused)
- /* Restore the FPU state. Mach conveniently stores the state
- in the format the i387 `frstor' instruction uses to restore it. */
- asm volatile ("frstor %0" : : "m" (scp->sc_fpsave));
+#ifdef i386_XFLOAT_STATE
+ if (scp->xstate)
+ {
+ if (scp->xstate->initialized)
+ {
+ unsigned eax, ebx, ecx, edx;
+ __cpuid_count(0xd, 0, eax, ebx, ecx, edx);
+ switch (scp->xstate->fp_save_kind)
+ {
+ case 0: // FNSAVE
+ asm volatile("frstor %0" : : "m" (scp->xstate->hw_state));
+ break;
+ case 1: // FXSAVE
+ asm volatile("fxrstor %0" : : "m" (scp->xstate->hw_state), \
+ "a" (eax), "d" (edx));
+ break;
+ default: // XSAVE, XSAVEOPT, XSAVEC, XSAVES
+ asm volatile("xrstor %0" : : "m" (scp->xstate->hw_state), \
+ "a" (eax), "d" (edx));
+ break;
+ }
+ }
+ }
+ else
+#endif
+ if (scp->sc_fpused)
+ /* Restore the FPU state. Mach conveniently stores the state
+ in the format the i387 `frstor' instruction uses to restore it. */
+ asm volatile ("frstor %0" : : "m" (scp->sc_fpsave));
/* Copy the registers onto the user's stack, to be able to release the
altstack (by unlocking sigstate). Note that unless an altstack is used,