summary refs log tree commit diff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-10-01 17:46:39 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-10-01 17:46:54 -0700
commitdd3121df08d5ee44ba770d12365022aa802fb364 (patch)
tree679bb661f8835c1ba69229daad5b4f3b8c838e32
parent047d1a81fd82db4cd7458fec37230f3b31b414e9 (diff)
downloadglibc-dd3121df08d5ee44ba770d12365022aa802fb364.tar.gz
glibc-dd3121df08d5ee44ba770d12365022aa802fb364.tar.xz
glibc-dd3121df08d5ee44ba770d12365022aa802fb364.zip
Hide internal __setrlimit function [BZ #18822]
Hide internal __setrlimit function to allow direct access within libc.so
and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/sys/resource.h (__setrlimit): Add libc_hidden_proto.
	* resource/setrlimit.c (__setrlimit): Add libc_hidden_def.
	* sysdeps/mach/hurd/setrlimit.c (__setrlimit): Likewise.
	* sysdeps/unix/sysv/linux/setrlimit.c (__setrlimit): Likewise.
	* sysdeps/unix/sysv/linux/setrlimit64.c (__GI___setrlimit): New.
-rw-r--r--ChangeLog9
-rw-r--r--include/sys/resource.h1
-rw-r--r--resource/setrlimit.c1
-rw-r--r--sysdeps/mach/hurd/setrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/setrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/setrlimit64.c3
6 files changed, 16 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 709f9836f8..86d30bedf2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #18822]
+	* include/sys/resource.h (__setrlimit): Add libc_hidden_proto.
+	* resource/setrlimit.c (__setrlimit): Add libc_hidden_def.
+	* sysdeps/mach/hurd/setrlimit.c (__setrlimit): Likewise.
+	* sysdeps/unix/sysv/linux/setrlimit.c (__setrlimit): Likewise.
+	* sysdeps/unix/sysv/linux/setrlimit64.c (__GI___setrlimit): New.
+
+2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #18822]
 	* include/monetary.h (__vstrfmon_l): Add attribute_hidden.
 
 2017-10-01  H.J. Lu  <hongjiu.lu@intel.com>
diff --git a/include/sys/resource.h b/include/sys/resource.h
index 688c46c4ae..c55d4e63bd 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -23,5 +23,6 @@ extern int __getrusage (enum __rusage_who __who, struct rusage *__usage)
 
 extern int __setrlimit (enum __rlimit_resource __resource,
 			const struct rlimit *__rlimits);
+libc_hidden_proto (__setrlimit);
 #endif
 #endif
diff --git a/resource/setrlimit.c b/resource/setrlimit.c
index 6e3a1fbc54..e02b6a826a 100644
--- a/resource/setrlimit.c
+++ b/resource/setrlimit.c
@@ -29,6 +29,7 @@ __setrlimit (enum __rlimit_resource resource, const struct rlimit *rlimits)
   __set_errno (ENOSYS);
   return -1;
 }
+libc_hidden_def (__setrlimit)
 weak_alias (__setrlimit, setrlimit)
 
 stub_warning (setrlimit)
diff --git a/sysdeps/mach/hurd/setrlimit.c b/sysdeps/mach/hurd/setrlimit.c
index 3ea9af2e7c..693422a537 100644
--- a/sysdeps/mach/hurd/setrlimit.c
+++ b/sysdeps/mach/hurd/setrlimit.c
@@ -53,4 +53,5 @@ __setrlimit (enum __rlimit_resource resource, const struct rlimit *rlimits)
   return 0;
 }
 
+libc_hidden_def (__setrlimit)
 weak_alias (__setrlimit, setrlimit)
diff --git a/sysdeps/unix/sysv/linux/setrlimit.c b/sysdeps/unix/sysv/linux/setrlimit.c
index 8773c78236..50a21636ef 100644
--- a/sysdeps/unix/sysv/linux/setrlimit.c
+++ b/sysdeps/unix/sysv/linux/setrlimit.c
@@ -48,6 +48,7 @@ __setrlimit (enum __rlimit_resource resource, const struct rlimit *rlim)
   return INLINE_SYSCALL_CALL (prlimit64, 0, resource, &rlim64, NULL);
 }
 
+libc_hidden_def (__setrlimit)
 # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
 strong_alias (__setrlimit, __setrlimit_1)
 compat_symbol (libc, __setrlimit, setrlimit, GLIBC_2_0);
diff --git a/sysdeps/unix/sysv/linux/setrlimit64.c b/sysdeps/unix/sysv/linux/setrlimit64.c
index db1960fc18..ff835c8733 100644
--- a/sysdeps/unix/sysv/linux/setrlimit64.c
+++ b/sysdeps/unix/sysv/linux/setrlimit64.c
@@ -43,4 +43,7 @@ weak_alias (__setrlimit64, setrlimit64)
 #if __RLIM_T_MATCHES_RLIM64_T
 strong_alias (__setrlimit64, __setrlimit)
 weak_alias (__setrlimit64, setrlimit)
+# ifdef SHARED
+__hidden_ver1 (__setrlimit64, __GI___setrlimit, __setrlimit64);
+# endif
 #endif