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.
This commit is contained in:
H.J. Lu 2017-10-01 17:46:39 -07:00
parent 047d1a81fd
commit dd3121df08
6 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,12 @@
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]

View File

@ -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

View File

@ -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)

View File

@ -53,4 +53,5 @@ __setrlimit (enum __rlimit_resource resource, const struct rlimit *rlimits)
return 0;
}
libc_hidden_def (__setrlimit)
weak_alias (__setrlimit, setrlimit)

View File

@ -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);

View File

@ -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