unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [hurd,commited 1/8] hurd: avoid PLT ref between sendfile and sendfile64
@ 2018-06-16  1:06 Samuel Thibault
  2018-06-16  1:06 ` [hurd,commited 2/8] hurd: Detect 32bit overflow in value returned by lseek Samuel Thibault
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Samuel Thibault @ 2018-06-16  1:06 UTC (permalink / raw
  To: libc-alpha; +Cc: Samuel Thibault

	* include/sys/sendfile.h (__sendfile64): Declare hidden prototype.
	* sysdeps/mach/hurd/sendfile.c (sendfile): Call __sendfile64 instead
	of sendfile.
	* sysdeps/mach/hurd/sendfile64.c (sendfile64): Rename to __sendfile64.
	(sendfile64): New strong alias.
---
 ChangeLog                      | 8 ++++++++
 include/sys/sendfile.h         | 6 ++++++
 sysdeps/mach/hurd/sendfile.c   | 4 ++--
 sysdeps/mach/hurd/sendfile64.c | 3 ++-
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a8f711fcd7..74c14d4f84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-06-15  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* include/sys/sendfile.h (__sendfile64): Declare hidden prototype.
+	* sysdeps/mach/hurd/sendfile.c (sendfile): Call __sendfile64 instead
+	of sendfile.
+	* sysdeps/mach/hurd/sendfile64.c (sendfile64): Rename to __sendfile64.
+	(sendfile64): New strong alias.
+
 2018-06-15  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #23007]
diff --git a/include/sys/sendfile.h b/include/sys/sendfile.h
index abe09769cc..b88cca27b8 100644
--- a/include/sys/sendfile.h
+++ b/include/sys/sendfile.h
@@ -1 +1,7 @@
 #include <io/sys/sendfile.h>
+
+#ifndef _ISOMAC
+
+extern __typeof (sendfile64) __sendfile64 attribute_hidden;
+
+#endif
diff --git a/sysdeps/mach/hurd/sendfile.c b/sysdeps/mach/hurd/sendfile.c
index 6a3de0fcc1..4df66b56d7 100644
--- a/sysdeps/mach/hurd/sendfile.c
+++ b/sysdeps/mach/hurd/sendfile.c
@@ -25,11 +25,11 @@ ssize_t
 sendfile (int out_fd, int in_fd, off_t *offset, size_t count)
 {
   if (offset == NULL || sizeof (off_t) == sizeof (off64_t))
-    return sendfile64 (out_fd, in_fd, (off64_t *) offset, count);
+    return __sendfile64 (out_fd, in_fd, (off64_t *) offset, count);
   else
     {
       off64_t ofs = *offset;
-      ssize_t ret = sendfile64 (out_fd, in_fd, &ofs, count);
+      ssize_t ret = __sendfile64 (out_fd, in_fd, &ofs, count);
       *offset = ofs;
       return ret;
     }
diff --git a/sysdeps/mach/hurd/sendfile64.c b/sysdeps/mach/hurd/sendfile64.c
index f69ccd4a79..ea4e96da90 100644
--- a/sysdeps/mach/hurd/sendfile64.c
+++ b/sysdeps/mach/hurd/sendfile64.c
@@ -24,7 +24,7 @@
 /* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
    descriptor OUT_FD.  */
 ssize_t
-sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count)
+__sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count)
 {
   /* We just do a vanilla io_read followed by a vanilla io_write here.
      In theory the IN_FD filesystem can return us out-of-line data that
@@ -57,3 +57,4 @@ sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count)
     }
   return __hurd_fail (err);
 }
+strong_alias (__sendfile64, sendfile64)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [hurd,commited 2/8] hurd: Detect 32bit overflow in value returned by lseek
  2018-06-16  1:06 [hurd,commited 1/8] hurd: avoid PLT ref between sendfile and sendfile64 Samuel Thibault
@ 2018-06-16  1:06 ` Samuel Thibault
  2018-06-16  1:06 ` [hurd,commited 3/8] hurd: Avoid PLT ref for __pthread_get_cleanup_stack Samuel Thibault
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2018-06-16  1:06 UTC (permalink / raw
  To: libc-alpha; +Cc: Samuel Thibault

	* sysdeps/mach/hurd/lseek.c: Include <errno.h>.
	* sysdeps/mach/hurd/lseek.c (__libc_lseek): Check that the value returned
	by __lseek64 can fit off_t, return EOVERFLOW otherwise.
---
 ChangeLog                 |  3 +++
 sysdeps/mach/hurd/lseek.c | 12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 74c14d4f84..0a2e082d73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
 	of sendfile.
 	* sysdeps/mach/hurd/sendfile64.c (sendfile64): Rename to __sendfile64.
 	(sendfile64): New strong alias.
+	* sysdeps/mach/hurd/lseek.c: Include <errno.h>.
+	* sysdeps/mach/hurd/lseek.c (__libc_lseek): Check that the value
+	returned by __lseek64 can fit off_t, return EOVERFLOW otherwise.
 
 2018-06-15  Joseph Myers  <joseph@codesourcery.com>
 
diff --git a/sysdeps/mach/hurd/lseek.c b/sysdeps/mach/hurd/lseek.c
index 6677e01202..0a4077268a 100644
--- a/sysdeps/mach/hurd/lseek.c
+++ b/sysdeps/mach/hurd/lseek.c
@@ -17,12 +17,22 @@
 
 #include <unistd.h>
 #include <sys/types.h>
+#include <errno.h>
 
 /* Seek to OFFSET on FD, starting from WHENCE.  */
 off_t
 __libc_lseek (int fd, off_t offset, int whence)
 {
-  return __libc_lseek64 (fd, (off64_t) offset, whence);
+  off64_t res64 = __libc_lseek64 (fd, (off64_t) offset, whence);
+  off_t res = (off_t) res64;
+
+  if (sizeof res != sizeof res64 && res != res64)
+    {
+      __set_errno (EOVERFLOW);
+      return (off_t) -1;
+    }
+
+  return res;
 }
 
 weak_alias (__libc_lseek, __lseek)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [hurd,commited 3/8] hurd: Avoid PLT ref for __pthread_get_cleanup_stack
  2018-06-16  1:06 [hurd,commited 1/8] hurd: avoid PLT ref between sendfile and sendfile64 Samuel Thibault
  2018-06-16  1:06 ` [hurd,commited 2/8] hurd: Detect 32bit overflow in value returned by lseek Samuel Thibault
@ 2018-06-16  1:06 ` Samuel Thibault
  2018-06-16  1:06 ` [hurd,commited 4/8] hurd: Avoid missing PLT ref from ld.so requirement Samuel Thibault
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2018-06-16  1:06 UTC (permalink / raw
  To: libc-alpha; +Cc: Samuel Thibault

	* htl/pt-cleanup.c (___pthread_get_cleanup_stack): Rename to
	__pthread_get_cleanup_stack.
	(__pthread_get_cleanup_stack): Remove alias, add hidden def.
	* htl/pt-exit.c (__pthread_exit): Use __pthread_get_cleanup_stack
	instead of ___pthread_get_cleanup_stack.
	* sysdeps/htl/pthread-functions.h [libpthread]
	(__pthread_get_cleanup_stack): Add hidden proto.
	* sysdeps/htl/pthreadP.h (___pthread_get_cleanup_stack): Remove
	prototype.
---
 ChangeLog                       | 9 +++++++++
 htl/pt-cleanup.c                | 4 ++--
 htl/pt-exit.c                   | 2 +-
 sysdeps/htl/pthread-functions.h | 3 +++
 sysdeps/htl/pthreadP.h          | 1 -
 5 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0a2e082d73..390c2a1a9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,15 @@
 	* sysdeps/mach/hurd/lseek.c: Include <errno.h>.
 	* sysdeps/mach/hurd/lseek.c (__libc_lseek): Check that the value
 	returned by __lseek64 can fit off_t, return EOVERFLOW otherwise.
+	* htl/pt-cleanup.c (___pthread_get_cleanup_stack): Rename to
+	__pthread_get_cleanup_stack.
+	(__pthread_get_cleanup_stack): Remove alias, add hidden def.
+	* htl/pt-exit.c (__pthread_exit): Use __pthread_get_cleanup_stack
+	instead of ___pthread_get_cleanup_stack.
+	* sysdeps/htl/pthread-functions.h [libpthread]
+	(__pthread_get_cleanup_stack): Add hidden proto.
+	* sysdeps/htl/pthreadP.h (___pthread_get_cleanup_stack): Remove
+	prototype.
 
 2018-06-15  Joseph Myers  <joseph@codesourcery.com>
 
diff --git a/htl/pt-cleanup.c b/htl/pt-cleanup.c
index 1b860c7bf7..b4a9834dc1 100644
--- a/htl/pt-cleanup.c
+++ b/htl/pt-cleanup.c
@@ -21,8 +21,8 @@
 #include <pt-internal.h>
 
 struct __pthread_cancelation_handler **
-___pthread_get_cleanup_stack (void)
+__pthread_get_cleanup_stack (void)
 {
   return &_pthread_self ()->cancelation_handlers;
 }
-strong_alias (___pthread_get_cleanup_stack, __pthread_get_cleanup_stack)
+libc_hidden_def (__pthread_get_cleanup_stack)
diff --git a/htl/pt-exit.c b/htl/pt-exit.c
index cb62f474fa..823e09e26e 100644
--- a/htl/pt-exit.c
+++ b/htl/pt-exit.c
@@ -41,7 +41,7 @@ __pthread_exit (void *status)
      disabled.  */
   __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate);
 
-  for (handlers = ___pthread_get_cleanup_stack ();
+  for (handlers = __pthread_get_cleanup_stack ();
        *handlers != NULL;
        *handlers = (*handlers)->__next)
     (*handlers)->__handler ((*handlers)->__arg);
diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h
index a0d06cc039..bb901e3b7f 100644
--- a/sysdeps/htl/pthread-functions.h
+++ b/sysdeps/htl/pthread-functions.h
@@ -60,6 +60,9 @@ pthread_t __pthread_self (void);
 int __pthread_setcancelstate (int, int *);
 int __pthread_setcanceltype (int, int *);
 struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void);
+#if IS_IN (libpthread)
+hidden_proto (__pthread_get_cleanup_stack)
+#endif
 int __pthread_once (pthread_once_t *, void (*) (void));
 int __pthread_rwlock_rdlock (pthread_rwlock_t *);
 int __pthread_rwlock_wrlock (pthread_rwlock_t *);
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index 6c9aa6cb75..3fcb811f49 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -64,7 +64,6 @@ int __pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize);
 int __pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
 			     size_t __stacksize);
 int __pthread_attr_getstack (const pthread_attr_t *, void **, size_t *);
-struct __pthread_cancelation_handler **___pthread_get_cleanup_stack (void);
 
 #if IS_IN (libpthread)
 hidden_proto (__pthread_key_create)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [hurd,commited 4/8] hurd: Avoid missing PLT ref from ld.so requirement
  2018-06-16  1:06 [hurd,commited 1/8] hurd: avoid PLT ref between sendfile and sendfile64 Samuel Thibault
  2018-06-16  1:06 ` [hurd,commited 2/8] hurd: Detect 32bit overflow in value returned by lseek Samuel Thibault
  2018-06-16  1:06 ` [hurd,commited 3/8] hurd: Avoid PLT ref for __pthread_get_cleanup_stack Samuel Thibault
@ 2018-06-16  1:06 ` Samuel Thibault
  2018-06-16  1:06 ` [hurd,commited 5/8] hurd: Avoid PLT references to shortcuts Samuel Thibault
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2018-06-16  1:06 UTC (permalink / raw
  To: libc-alpha; +Cc: Samuel Thibault

	* sysdeps/mach/hurd/localplt.data (ld.so): Make ref to __open optional.
---
 ChangeLog                       | 1 +
 sysdeps/mach/hurd/localplt.data | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 390c2a1a9d..7ceaa829a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,7 @@
 	(__pthread_get_cleanup_stack): Add hidden proto.
 	* sysdeps/htl/pthreadP.h (___pthread_get_cleanup_stack): Remove
 	prototype.
+	* sysdeps/mach/hurd/localplt.data (ld.so): Make ref to __open optional.
 
 2018-06-15  Joseph Myers  <joseph@codesourcery.com>
 
diff --git a/sysdeps/mach/hurd/localplt.data b/sysdeps/mach/hurd/localplt.data
index 4df5ae5d63..58d119e3b9 100644
--- a/sysdeps/mach/hurd/localplt.data
+++ b/sysdeps/mach/hurd/localplt.data
@@ -20,7 +20,7 @@ ld.so: _dl_signal_exception
 ld.so: _dl_catch_exception
 # The dynamic linker has its own versions of basic functions for initial loading
 # of shared libraries.  These need to be overriden by libc once loaded.
-ld.so: __open
+ld.so: __open ?
 ld.so: __open64 ?
 ld.so: __close
 ld.so: __read ?
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [hurd,commited 5/8] hurd: Avoid PLT references to shortcuts
  2018-06-16  1:06 [hurd,commited 1/8] hurd: avoid PLT ref between sendfile and sendfile64 Samuel Thibault
                   ` (2 preceding siblings ...)
  2018-06-16  1:06 ` [hurd,commited 4/8] hurd: Avoid missing PLT ref from ld.so requirement Samuel Thibault
@ 2018-06-16  1:06 ` Samuel Thibault
  2018-06-16  1:06 ` [hurd,commited 6/8] hurd: Avoid PLT ref to __mach_msg Samuel Thibault
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2018-06-16  1:06 UTC (permalink / raw
  To: libc-alpha; +Cc: Samuel Thibault

	* sysdeps/mach/include/mach-shortcuts-hidden.h: New file.
	* mach/shortcut.awk: Make syscall stubs include
	<mach-shortcuts-hidden.h> and add hidden definition.
	* sysdeps/mach/include/mach.h: Include <mach-shortcuts-hidden.h>.
---
 ChangeLog                                    |  4 ++++
 mach/shortcut.awk                            |  2 ++
 sysdeps/mach/include/mach-shortcuts-hidden.h | 13 +++++++++++++
 sysdeps/mach/include/mach.h                  |  1 +
 4 files changed, 20 insertions(+)
 create mode 100644 sysdeps/mach/include/mach-shortcuts-hidden.h

diff --git a/ChangeLog b/ChangeLog
index 7ceaa829a8..4defdb6462 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,10 @@
 	* sysdeps/htl/pthreadP.h (___pthread_get_cleanup_stack): Remove
 	prototype.
 	* sysdeps/mach/hurd/localplt.data (ld.so): Make ref to __open optional.
+	* sysdeps/mach/include/mach-shortcuts-hidden.h: New file.
+	* mach/shortcut.awk: Make syscall stubs include
+	<mach-shortcuts-hidden.h> and add hidden definition.
+	* sysdeps/mach/include/mach.h: Include <mach-shortcuts-hidden.h>.
 
 2018-06-15  Joseph Myers  <joseph@codesourcery.com>
 
diff --git a/mach/shortcut.awk b/mach/shortcut.awk
index ea283d49ba..090da82b6a 100644
--- a/mach/shortcut.awk
+++ b/mach/shortcut.awk
@@ -1,6 +1,7 @@
 # Icky intimate knowledge of MiG output.
 
 BEGIN { print "/* This file is generated by shortcut.awk.  */";
+	print "#include <mach-shortcuts-hidden.h>";
 	echo=1;
 	inproto=0; proto=""; arglist="";
       }
@@ -44,6 +45,7 @@ echo == 1 { print $0; }
     print "  return err;"
     print "}";
     print "weak_alias (" call ", " alias ")";
+    print "libc_hidden_def (" call ")";
     # Declare RPC so the weak_alias that follows will work.
     print "extern __typeof (" call ") " rpc ";";
     echo = 1;
diff --git a/sysdeps/mach/include/mach-shortcuts-hidden.h b/sysdeps/mach/include/mach-shortcuts-hidden.h
new file mode 100644
index 0000000000..0942871f26
--- /dev/null
+++ b/sysdeps/mach/include/mach-shortcuts-hidden.h
@@ -0,0 +1,13 @@
+#include <mach-shortcuts.h>
+libc_hidden_proto (__task_create)
+libc_hidden_proto (__task_terminate)
+libc_hidden_proto (__vm_allocate)
+libc_hidden_proto (__vm_deallocate)
+libc_hidden_proto (__task_suspend)
+libc_hidden_proto (__task_set_special_port)
+libc_hidden_proto (__vm_map)
+libc_hidden_proto (__thread_depress_abort)
+libc_hidden_proto (__mach_port_allocate_name)
+libc_hidden_proto (__mach_port_allocate)
+libc_hidden_proto (__mach_port_deallocate)
+libc_hidden_proto (__mach_port_insert_right)
diff --git a/sysdeps/mach/include/mach.h b/sysdeps/mach/include/mach.h
index b4c2f45240..fff8349b82 100644
--- a/sysdeps/mach/include/mach.h
+++ b/sysdeps/mach/include/mach.h
@@ -1,5 +1,6 @@
 #ifndef	_MACH_H
 #include_next <mach.h>
+#include <mach-shortcuts-hidden.h>
 #ifndef _ISOMAC
 libc_hidden_proto (__mach_msg_destroy)
 #endif
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [hurd,commited 6/8] hurd: Avoid PLT ref to __mach_msg
  2018-06-16  1:06 [hurd,commited 1/8] hurd: avoid PLT ref between sendfile and sendfile64 Samuel Thibault
                   ` (3 preceding siblings ...)
  2018-06-16  1:06 ` [hurd,commited 5/8] hurd: Avoid PLT references to shortcuts Samuel Thibault
@ 2018-06-16  1:06 ` Samuel Thibault
  2018-06-16  1:06 ` [hurd,commited 7/8] hurd: Avoid PLT references to syscalls Samuel Thibault
  2018-06-16  1:06 ` [hurd,commited 8/8] hurd: Whitelist PLT refs which are difficult to avoid Samuel Thibault
  6 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2018-06-16  1:06 UTC (permalink / raw
  To: libc-alpha; +Cc: Samuel Thibault

	* sysdeps/mach/include/mach.h (__mach_msg): Add hidden prototype.
	* mach/msg.c: Include <mach.h>.
	(__mach_msg): Add hidden definition.
---
 ChangeLog                   | 3 +++
 mach/msg.c                  | 2 ++
 sysdeps/mach/include/mach.h | 1 +
 3 files changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 4defdb6462..d81c823448 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,9 @@
 	* mach/shortcut.awk: Make syscall stubs include
 	<mach-shortcuts-hidden.h> and add hidden definition.
 	* sysdeps/mach/include/mach.h: Include <mach-shortcuts-hidden.h>.
+	(__mach_msg): Add hidden prototype.
+	* mach/msg.c: Include <mach.h>.
+	(__mach_msg): Add hidden definition.
 
 2018-06-15  Joseph Myers  <joseph@codesourcery.com>
 
diff --git a/mach/msg.c b/mach/msg.c
index bccad7fd26..8eb252a16e 100644
--- a/mach/msg.c
+++ b/mach/msg.c
@@ -25,6 +25,7 @@
  */
 #include <mach/port.h>
 #include <mach/message.h>
+#include <mach.h>
 
 #ifdef MACH_MSG_OVERWRITE
 /* In variants with this feature, the actual system call is
@@ -125,6 +126,7 @@ __mach_msg (mach_msg_header_t *msg,
   return ret;
 }
 weak_alias (__mach_msg, mach_msg)
+libc_hidden_def (__mach_msg)
 
 mach_msg_return_t
 __mach_msg_send	(mach_msg_header_t *msg)
diff --git a/sysdeps/mach/include/mach.h b/sysdeps/mach/include/mach.h
index fff8349b82..65f8d9764b 100644
--- a/sysdeps/mach/include/mach.h
+++ b/sysdeps/mach/include/mach.h
@@ -3,5 +3,6 @@
 #include <mach-shortcuts-hidden.h>
 #ifndef _ISOMAC
 libc_hidden_proto (__mach_msg_destroy)
+libc_hidden_proto (__mach_msg)
 #endif
 #endif
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [hurd,commited 7/8] hurd: Avoid PLT references to syscalls
  2018-06-16  1:06 [hurd,commited 1/8] hurd: avoid PLT ref between sendfile and sendfile64 Samuel Thibault
                   ` (4 preceding siblings ...)
  2018-06-16  1:06 ` [hurd,commited 6/8] hurd: Avoid PLT ref to __mach_msg Samuel Thibault
@ 2018-06-16  1:06 ` Samuel Thibault
  2018-06-16  1:06 ` [hurd,commited 8/8] hurd: Whitelist PLT refs which are difficult to avoid Samuel Thibault
  6 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2018-06-16  1:06 UTC (permalink / raw
  To: libc-alpha; +Cc: Samuel Thibault

	* mach/Makefile ($(mach-syscalls:%=$(objpfx))): Add hidden definition.
	* sysdeps/mach/include/mach/mach_traps.h (__mach_reply_port,
	__mach_thread_self, __mach_task_self, __mach_host_self, __swtch,
	__swtch_pri, __thread_switch, __evc_wait): Add hidden prototypes.
---
 ChangeLog                              |  4 ++++
 mach/Makefile                          |  3 ++-
 sysdeps/mach/include/mach/mach_traps.h | 20 ++++++++++++++------
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d81c823448..8c4b6ccd2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,10 @@
 	(__mach_msg): Add hidden prototype.
 	* mach/msg.c: Include <mach.h>.
 	(__mach_msg): Add hidden definition.
+	* mach/Makefile ($(mach-syscalls:%=$(objpfx))): Add hidden definition.
+	* sysdeps/mach/include/mach/mach_traps.h (__mach_reply_port,
+	__mach_thread_self, __mach_task_self, __mach_host_self, __swtch,
+	__swtch_pri, __thread_switch, __evc_wait): Add hidden prototypes.
 
 2018-06-15  Joseph Myers  <joseph@codesourcery.com>
 
diff --git a/mach/Makefile b/mach/Makefile
index 2683587b2d..435ae6882d 100644
--- a/mach/Makefile
+++ b/mach/Makefile
@@ -97,7 +97,8 @@ else
 $(mach-syscalls:%=$(objpfx)%.S): $(objpfx)%.S: $(objpfx)mach-syscalls.mk
 	(echo '#include <sysdep.h>'; \
 	 echo 'kernel_trap (__$*,$(sysno-$*),$(nargs-$*))'; \
-	 echo 'weak_alias (__$*, $*)') > $@-new
+	 echo 'weak_alias (__$*, $*)'; \
+	 echo 'libc_hidden_def (__$*)') > $@-new
 	 mv -f $@-new $@
 generated += $(mach-syscalls:=.S)
 endif	# mach-syscalls
diff --git a/sysdeps/mach/include/mach/mach_traps.h b/sysdeps/mach/include/mach/mach_traps.h
index d1b2febac1..2d4c1f9c5f 100644
--- a/sysdeps/mach/include/mach/mach_traps.h
+++ b/sysdeps/mach/include/mach/mach_traps.h
@@ -1,13 +1,21 @@
 #ifndef _MACH_MACH_TRAPS_H
 #include_next <mach/mach_traps.h>
 
-extern mach_port_t __mach_reply_port (void) attribute_hidden;
+extern mach_port_t __mach_reply_port (void);
+libc_hidden_proto (__mach_reply_port)
 extern mach_port_t __mach_thread_self (void);
+libc_hidden_proto (__mach_thread_self)
 extern mach_port_t (__mach_task_self) (void);
-extern mach_port_t (__mach_host_self) (void) attribute_hidden;
-extern boolean_t __swtch (void) attribute_hidden;
-extern boolean_t __swtch_pri (int priority) attribute_hidden;
+libc_hidden_proto (__mach_task_self)
+extern mach_port_t (__mach_host_self) (void);
+libc_hidden_proto (__mach_host_self)
+extern boolean_t __swtch (void);
+libc_hidden_proto (__swtch)
+extern boolean_t __swtch_pri (int priority);
+libc_hidden_proto (__swtch_pri)
 kern_return_t __thread_switch (mach_port_t new_thread,
-			     int option, mach_msg_timeout_t option_time) attribute_hidden;
-kern_return_t __evc_wait (unsigned int event) attribute_hidden;
+			     int option, mach_msg_timeout_t option_time);
+libc_hidden_proto (__thread_switch)
+kern_return_t __evc_wait (unsigned int event);
+libc_hidden_proto (__evc_wait)
 #endif
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [hurd,commited 8/8] hurd: Whitelist PLT refs which are difficult to avoid
  2018-06-16  1:06 [hurd,commited 1/8] hurd: avoid PLT ref between sendfile and sendfile64 Samuel Thibault
                   ` (5 preceding siblings ...)
  2018-06-16  1:06 ` [hurd,commited 7/8] hurd: Avoid PLT references to syscalls Samuel Thibault
@ 2018-06-16  1:06 ` Samuel Thibault
  6 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2018-06-16  1:06 UTC (permalink / raw
  To: libc-alpha; +Cc: Samuel Thibault

	* sysdeps/mach/hurd/localplt.data (siglongjmp, longjmp,
	__libc_lseek64, _IO_funlockfile): Whitelist PLT references.
---
 ChangeLog                       | 2 ++
 sysdeps/mach/hurd/localplt.data | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 8c4b6ccd2f..2fc3a71c21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,8 @@
 	* sysdeps/mach/include/mach/mach_traps.h (__mach_reply_port,
 	__mach_thread_self, __mach_task_self, __mach_host_self, __swtch,
 	__swtch_pri, __thread_switch, __evc_wait): Add hidden prototypes.
+	* sysdeps/mach/hurd/localplt.data (siglongjmp, longjmp,
+	__libc_lseek64, _IO_funlockfile): Whitelist PLT references.
 
 2018-06-15  Joseph Myers  <joseph@codesourcery.com>
 
diff --git a/sysdeps/mach/hurd/localplt.data b/sysdeps/mach/hurd/localplt.data
index 58d119e3b9..a1f1ae626a 100644
--- a/sysdeps/mach/hurd/localplt.data
+++ b/sysdeps/mach/hurd/localplt.data
@@ -52,3 +52,11 @@ ld.so: _dl_init_first
 ld.so: _dl_mcount
 ld.so: ___tls_get_addr
 ld.so: __tunable_get_val
+
+# These should ideally be avoided, but is currently difficult
+libc.so: siglongjmp ?
+libc.so: longjmp ?
+# This is from lseek.c
+libc.so: __libc_lseek64 ?
+# This is through cleanup_region_start from vfprintf.c
+libc.so: _IO_funlockfile ?
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-06-16  1:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-16  1:06 [hurd,commited 1/8] hurd: avoid PLT ref between sendfile and sendfile64 Samuel Thibault
2018-06-16  1:06 ` [hurd,commited 2/8] hurd: Detect 32bit overflow in value returned by lseek Samuel Thibault
2018-06-16  1:06 ` [hurd,commited 3/8] hurd: Avoid PLT ref for __pthread_get_cleanup_stack Samuel Thibault
2018-06-16  1:06 ` [hurd,commited 4/8] hurd: Avoid missing PLT ref from ld.so requirement Samuel Thibault
2018-06-16  1:06 ` [hurd,commited 5/8] hurd: Avoid PLT references to shortcuts Samuel Thibault
2018-06-16  1:06 ` [hurd,commited 6/8] hurd: Avoid PLT ref to __mach_msg Samuel Thibault
2018-06-16  1:06 ` [hurd,commited 7/8] hurd: Avoid PLT references to syscalls Samuel Thibault
2018-06-16  1:06 ` [hurd,commited 8/8] hurd: Whitelist PLT refs which are difficult to avoid Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).