public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [hurd,commited 0/2] hurd: Fix some ld.so overrides from libc
@ 2019-12-01 21:22 Samuel Thibault
  2019-12-01 21:22 ` [hurd,commited 2/2] hurd: Fix ld.so __access override " Samuel Thibault
  2019-12-01 21:22 ` [hurd,commited 1/2] hurd: Fix ld.so __getcwd " Samuel Thibault
  0 siblings, 2 replies; 3+ messages in thread
From: Samuel Thibault @ 2019-12-01 21:22 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault, commit-hurd

ld.so symbols to be overriden by libc need to be extern to really get
overriden.

Samuel Thibault (2):
  hurd: Fix ld.so __getcwd override from libc
  hurd: Fix ld.so __access override from libc

 include/unistd.h                     |  6 ++++--
 io/access.c                          |  1 +
 io/getcwd.c                          |  1 +
 sysdeps/mach/hurd/Versions           | 12 ++++++------
 sysdeps/mach/hurd/access.c           |  1 +
 sysdeps/mach/hurd/getcwd.c           |  1 +
 sysdeps/mach/hurd/i386/localplt.data |  4 ++--
 sysdeps/posix/getcwd.c               |  1 +
 sysdeps/unix/sysv/linux/access.c     |  1 +
 sysdeps/unix/sysv/linux/getcwd.c     |  1 +
 10 files changed, 19 insertions(+), 10 deletions(-)

-- 
2.24.0

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

* [hurd,commited 2/2] hurd: Fix ld.so __access override from libc
  2019-12-01 21:22 [hurd,commited 0/2] hurd: Fix some ld.so overrides from libc Samuel Thibault
@ 2019-12-01 21:22 ` Samuel Thibault
  2019-12-01 21:22 ` [hurd,commited 1/2] hurd: Fix ld.so __getcwd " Samuel Thibault
  1 sibling, 0 replies; 3+ messages in thread
From: Samuel Thibault @ 2019-12-01 21:22 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault, commit-hurd

ld.so symbols to be overriden by libc need to be extern to really get
overriden. __access happens to have never been exposed, putting it to
GLIBC_PRIVATE.
---
 include/unistd.h                     | 3 ++-
 io/access.c                          | 1 +
 sysdeps/mach/hurd/Versions           | 8 ++++----
 sysdeps/mach/hurd/access.c           | 1 +
 sysdeps/mach/hurd/i386/localplt.data | 2 +-
 sysdeps/unix/sysv/linux/access.c     | 1 +
 6 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/unistd.h b/include/unistd.h
index dbfa53dd94..f48da2c7a3 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -25,7 +25,8 @@ libc_hidden_proto (tcgetpgrp)
 libc_hidden_proto (readlinkat)
 
 /* Now define the internal interfaces.  */
-extern int __access (const char *__name, int __type) attribute_hidden;
+extern int __access (const char *__name, int __type);
+libc_hidden_proto (__access)
 extern int __euidaccess (const char *__name, int __type);
 extern int __faccessat (int __fd, const char *__file, int __type, int __flag);
 extern int __faccessat_noerrno (int __fd, const char *__file, int __type,
diff --git a/io/access.c b/io/access.c
index dc9fb9d5b2..9106a9f842 100644
--- a/io/access.c
+++ b/io/access.c
@@ -39,6 +39,7 @@ __access (const char *file, int type)
   __set_errno (ENOSYS);
   return -1;
 }
+libc_hidden_def (__access)
 stub_warning (access)
 
 weak_alias (__access, access)
diff --git a/sysdeps/mach/hurd/Versions b/sysdeps/mach/hurd/Versions
index dc199bfd66..9dee71efa3 100644
--- a/sysdeps/mach/hurd/Versions
+++ b/sysdeps/mach/hurd/Versions
@@ -1,7 +1,7 @@
 libc {
   GLIBC_2.0 {
     # functions with a weak definition in the dynamic linker
-    __access; __mmap;
+    __mmap;
   }
   GLIBC_2.2.6 {
     # functions with a weak definition in the dynamic linker
@@ -9,7 +9,7 @@ libc {
   }
   GLIBC_PRIVATE {
     # Functions shared with the dynamic linker
-    __access_noerrno; __libc_read; __libc_write; __libc_lseek64;
+    __access; __access_noerrno; __libc_read; __libc_write; __libc_lseek64;
     __libc_lock_self0; __sigprocmask; __getcwd;
 
     _dl_init_first;
@@ -22,7 +22,7 @@ ld {
     __hurd_threadvar_stack_mask;  __hurd_threadvar_stack_offset;
 
     # functions that must be shared with libc
-    __access; __close; __getpid;
+    __close; __getpid;
     __mmap; __open; __read; __sbrk; __strtoul_internal;
     __write; __writev; __xstat64; __fxstat64;
     _exit; _hurd_intr_rpc_mach_msg;
@@ -40,7 +40,7 @@ ld {
     _dl_init_first;
 
     # functions that must be shared with libc
-    __access_noerrno; __libc_read; __libc_write; __libc_lseek64;
+    __access; __access_noerrno; __libc_read; __libc_write; __libc_lseek64;
     __libc_lock_self0; __sigprocmask; __getcwd;
   }
 }
diff --git a/sysdeps/mach/hurd/access.c b/sysdeps/mach/hurd/access.c
index 2b5de8ea03..5072742352 100644
--- a/sysdeps/mach/hurd/access.c
+++ b/sysdeps/mach/hurd/access.c
@@ -35,4 +35,5 @@ __access (const char *file, int type)
 {
   return __faccessat (AT_FDCWD, file, type, 0);
 }
+libc_hidden_def (__access)
 weak_alias (__access, access)
diff --git a/sysdeps/mach/hurd/i386/localplt.data b/sysdeps/mach/hurd/i386/localplt.data
index 0c1cf0ffa9..b89e04b24a 100644
--- a/sysdeps/mach/hurd/i386/localplt.data
+++ b/sysdeps/mach/hurd/i386/localplt.data
@@ -32,7 +32,7 @@ ld.so: __libc_lseek64
 ld.so: __mmap
 ld.so: __fxstat64
 ld.so: __xstat64
-#ld.so: __access
+ld.so: __access
 ld.so: __access_noerrno
 ld.so: __getpid
 ld.so: __getcwd
diff --git a/sysdeps/unix/sysv/linux/access.c b/sysdeps/unix/sysv/linux/access.c
index 690c99a856..f9fd6e64cf 100644
--- a/sysdeps/unix/sysv/linux/access.c
+++ b/sysdeps/unix/sysv/linux/access.c
@@ -29,4 +29,5 @@ __access (const char *file, int type)
   return INLINE_SYSCALL_CALL (faccessat, AT_FDCWD, file, type);
 #endif
 }
+libc_hidden_def (__access)
 weak_alias (__access, access)
-- 
2.24.0

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

* [hurd,commited 1/2] hurd: Fix ld.so __getcwd override from libc
  2019-12-01 21:22 [hurd,commited 0/2] hurd: Fix some ld.so overrides from libc Samuel Thibault
  2019-12-01 21:22 ` [hurd,commited 2/2] hurd: Fix ld.so __access override " Samuel Thibault
@ 2019-12-01 21:22 ` Samuel Thibault
  1 sibling, 0 replies; 3+ messages in thread
From: Samuel Thibault @ 2019-12-01 21:22 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault, commit-hurd

ld.so symbols to be overriden by libc need to be extern to really get
overriden. __getcwd happens to have never been exposed, putting it to
GLIBC_PRIVATE.
---
 include/unistd.h                     | 3 ++-
 io/getcwd.c                          | 1 +
 sysdeps/mach/hurd/Versions           | 8 ++++----
 sysdeps/mach/hurd/getcwd.c           | 1 +
 sysdeps/mach/hurd/i386/localplt.data | 2 +-
 sysdeps/posix/getcwd.c               | 1 +
 sysdeps/unix/sysv/linux/getcwd.c     | 1 +
 7 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/unistd.h b/include/unistd.h
index a043431ecf..dbfa53dd94 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -75,7 +75,8 @@ extern int __lchown (const char *__file, __uid_t __owner,
 		     __gid_t __group);
 extern int __chdir (const char *__path) attribute_hidden;
 extern int __fchdir (int __fd) attribute_hidden;
-extern char *__getcwd (char *__buf, size_t __size) attribute_hidden;
+extern char *__getcwd (char *__buf, size_t __size);
+libc_hidden_proto (__getcwd)
 extern int __rmdir (const char *__path) attribute_hidden;
 extern int __execvpe (const char *file, char *const argv[],
 		      char *const envp[]) attribute_hidden;
diff --git a/io/getcwd.c b/io/getcwd.c
index 9744a5fcdc..98e8cc164a 100644
--- a/io/getcwd.c
+++ b/io/getcwd.c
@@ -32,6 +32,7 @@ __getcwd (char *buf, size_t size)
   __set_errno (ENOSYS);
   return NULL;
 }
+libc_hidden_def (__getcwd)
 weak_alias (__getcwd, getcwd)
 
 stub_warning (__getcwd)
diff --git a/sysdeps/mach/hurd/Versions b/sysdeps/mach/hurd/Versions
index c0b73cf0bf..dc199bfd66 100644
--- a/sysdeps/mach/hurd/Versions
+++ b/sysdeps/mach/hurd/Versions
@@ -1,7 +1,7 @@
 libc {
   GLIBC_2.0 {
     # functions with a weak definition in the dynamic linker
-    __access; __getcwd; __mmap;
+    __access; __mmap;
   }
   GLIBC_2.2.6 {
     # functions with a weak definition in the dynamic linker
@@ -10,7 +10,7 @@ libc {
   GLIBC_PRIVATE {
     # Functions shared with the dynamic linker
     __access_noerrno; __libc_read; __libc_write; __libc_lseek64;
-    __libc_lock_self0; __sigprocmask;
+    __libc_lock_self0; __sigprocmask; __getcwd;
 
     _dl_init_first;
   }
@@ -22,7 +22,7 @@ ld {
     __hurd_threadvar_stack_mask;  __hurd_threadvar_stack_offset;
 
     # functions that must be shared with libc
-    __access; __close; __getcwd; __getpid;
+    __access; __close; __getpid;
     __mmap; __open; __read; __sbrk; __strtoul_internal;
     __write; __writev; __xstat64; __fxstat64;
     _exit; _hurd_intr_rpc_mach_msg;
@@ -41,6 +41,6 @@ ld {
 
     # functions that must be shared with libc
     __access_noerrno; __libc_read; __libc_write; __libc_lseek64;
-    __libc_lock_self0; __sigprocmask;
+    __libc_lock_self0; __sigprocmask; __getcwd;
   }
 }
diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c
index 2757ac7ce8..4114991144 100644
--- a/sysdeps/mach/hurd/getcwd.c
+++ b/sysdeps/mach/hurd/getcwd.c
@@ -306,4 +306,5 @@ __getcwd (char *buf, size_t size)
 							    buf, size));
   return cwd;
 }
+libc_hidden_def (__getcwd)
 weak_alias (__getcwd, getcwd)
diff --git a/sysdeps/mach/hurd/i386/localplt.data b/sysdeps/mach/hurd/i386/localplt.data
index 1aef944337..0c1cf0ffa9 100644
--- a/sysdeps/mach/hurd/i386/localplt.data
+++ b/sysdeps/mach/hurd/i386/localplt.data
@@ -35,7 +35,7 @@ ld.so: __xstat64
 #ld.so: __access
 ld.so: __access_noerrno
 ld.so: __getpid
-#ld.so: __getcwd
+ld.so: __getcwd
 ld.so: __sbrk
 ld.so: __strtoul_internal
 #ld.so: _exit
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index 86fb366250..4a721c4cc6 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -531,5 +531,6 @@ __getcwd (char *buf, size_t size)
 }
 
 #if defined _LIBC && !defined __getcwd
+libc_hidden_def (__getcwd)
 weak_alias (__getcwd, getcwd)
 #endif
diff --git a/sysdeps/unix/sysv/linux/getcwd.c b/sysdeps/unix/sysv/linux/getcwd.c
index eec986e699..c031e1ff5a 100644
--- a/sysdeps/unix/sysv/linux/getcwd.c
+++ b/sysdeps/unix/sysv/linux/getcwd.c
@@ -127,6 +127,7 @@ __getcwd (char *buf, size_t size)
 
   return NULL;
 }
+libc_hidden_def (__getcwd)
 weak_alias (__getcwd, getcwd)
 
 /* Get the code for the generic version.  */
-- 
2.24.0

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

end of thread, other threads:[~2019-12-01 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-01 21:22 [hurd,commited 0/2] hurd: Fix some ld.so overrides from libc Samuel Thibault
2019-12-01 21:22 ` [hurd,commited 2/2] hurd: Fix ld.so __access override " Samuel Thibault
2019-12-01 21:22 ` [hurd,commited 1/2] hurd: Fix ld.so __getcwd " 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).