Ensure raw fchmod/fchmodat syscalls are hidden.
In https://android-review.googlesource.com/#/c/127908/5/libc/SYSCALLS.TXT@116
Elliott said:
for LP64 these will be hidden. for LP32 we were cowards and left
them all public for compatibility (though i don't think we ever
dremeled to see whether it was needed). we don't have an easy
way to recognize additions, though, so we can't prevent adding
new turds.
Add a mechanism to prevent the adding of new turds, and use that
mechanism on the fchmod/fchmodat system calls.
Bug: 19233951
Change-Id: I98f98345970b631a379f348df57858f9fc3d57c0
diff --git a/libc/bionic/fchmod.cpp b/libc/bionic/fchmod.cpp
index 6e020b6..ace8c6b 100644
--- a/libc/bionic/fchmod.cpp
+++ b/libc/bionic/fchmod.cpp
@@ -33,11 +33,11 @@
#include <unistd.h>
#include <stdio.h>
-extern "C" int __fchmod(int, mode_t);
+extern "C" int ___fchmod(int, mode_t);
int fchmod(int fd, mode_t mode) {
int saved_errno = errno;
- int result = __fchmod(fd, mode);
+ int result = ___fchmod(fd, mode);
if ((result == 0) || (errno != EBADF)) {
return result;
diff --git a/libc/bionic/fchmodat.cpp b/libc/bionic/fchmodat.cpp
index c28e15a..1f83c4b 100644
--- a/libc/bionic/fchmodat.cpp
+++ b/libc/bionic/fchmodat.cpp
@@ -34,7 +34,7 @@
#include "private/ErrnoRestorer.h"
-extern "C" int __fchmodat(int, const char*, mode_t);
+extern "C" int ___fchmodat(int, const char*, mode_t);
int fchmodat(int dirfd, const char* pathname, mode_t mode, int flags) {
if ((flags & ~AT_SYMLINK_NOFOLLOW) != 0) {
@@ -63,5 +63,5 @@
return result;
}
- return __fchmodat(dirfd, pathname, mode);
+ return ___fchmodat(dirfd, pathname, mode);
}