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/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index 4e24077..7e11418 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -286,8 +286,9 @@
for alias in aliases:
stub += function_alias % { "func" : syscall["func"], "alias" : alias }
- # Use hidden visibility for any functions beginning with underscores.
- if pointer_length == 64 and syscall["func"].startswith("__"):
+ # Use hidden visibility on LP64 for any functions beginning with underscores.
+ # Force hidden visibility for any functions which begin with 3 underscores
+ if (pointer_length == 64 and syscall["func"].startswith("__")) or syscall["func"].startswith("___"):
stub += '.hidden ' + syscall["func"] + '\n'
return stub