Hide __chmod and __mkdir [BZ #18822]

Hide internal __chmod and __mkdir functions to allow direct access
within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/sys/stat.h (__chmod): Add libc_hidden_proto.
	(__mkdir): Likewise.
	* io/chmod.c (__chmod): Add libc_hidden_def.
	* io/mkdir.c (__mkdir): Likewise.
	* sysdeps/mach/hurd/chmod.c (__chmod): Likewise.
	* sysdeps/mach/hurd/mkdir.c (__mkdir): Likewise.
	* sysdeps/unix/sysv/linux/generic/chmod.c (__chmod): Likewise.
	* sysdeps/unix/sysv/linux/generic/mkdir.c (__mkdir): Likewise.
This commit is contained in:
H.J. Lu 2017-09-04 13:38:36 -07:00
parent 1650e19265
commit 0a587a8a98
8 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,15 @@
2017-09-04 H.J. Lu <hongjiu.lu@intel.com>
[BZ #18822]
* include/sys/stat.h (__chmod): Add libc_hidden_proto.
(__mkdir): Likewise.
* io/chmod.c (__chmod): Add libc_hidden_def.
* io/mkdir.c (__mkdir): Likewise.
* sysdeps/mach/hurd/chmod.c (__chmod): Likewise.
* sysdeps/mach/hurd/mkdir.c (__mkdir): Likewise.
* sysdeps/unix/sysv/linux/generic/chmod.c (__chmod): Likewise.
* sysdeps/unix/sysv/linux/generic/mkdir.c (__mkdir): Likewise.
2017-09-04 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel

View File

@ -7,9 +7,11 @@ extern int __stat (const char *__file, struct stat *__buf);
extern int __fstat (int __fd, struct stat *__buf);
extern int __lstat (const char *__file, struct stat *__buf);
extern int __chmod (const char *__file, __mode_t __mode);
libc_hidden_proto (__chmod)
extern int __fchmod (int __fd, __mode_t __mode);
extern __mode_t __umask (__mode_t __mask);
extern int __mkdir (const char *__path, __mode_t __mode);
libc_hidden_proto (__mkdir)
extern int __mknod (const char *__path,
__mode_t __mode, __dev_t __dev);
#if IS_IN (libc) || IS_IN (rtld)

View File

@ -35,4 +35,5 @@ __chmod (const char *file, mode_t mode)
}
stub_warning (chmod)
libc_hidden_def (__chmod)
weak_alias (__chmod, chmod)

View File

@ -36,4 +36,5 @@ __mkdir (const char *path, mode_t mode)
}
stub_warning (mkdir)
libc_hidden_def (__mkdir)
weak_alias (__mkdir, mkdir)

View File

@ -35,4 +35,5 @@ __chmod (const char *file, mode_t mode)
return 0;
}
libc_hidden_def (__chmod)
weak_alias (__chmod, chmod)

View File

@ -40,4 +40,5 @@ __mkdir (const char *file_name, mode_t mode)
return 0;
}
libc_hidden_def (__mkdir)
weak_alias (__mkdir, mkdir)

View File

@ -28,4 +28,6 @@ __chmod (const char *file, mode_t mode)
{
return INLINE_SYSCALL (fchmodat, 3, AT_FDCWD, file, mode);
}
libc_hidden_def (__chmod)
weak_alias (__chmod, chmod)

View File

@ -30,4 +30,6 @@ __mkdir (const char *path, mode_t mode)
{
return INLINE_SYSCALL (mkdirat, 3, AT_FDCWD, path, mode);
}
libc_hidden_def (__mkdir)
weak_alias (__mkdir, mkdir)