commit f774a4977fbc497b85417bcbc1fa9b3f3220164a
parent e892e1188129de42ea7068dbaee85e8bc62f7170
Author: jvoisin <julien.voisin@dustri.org>
Date: Sat, 8 Jul 2023 22:00:26 +0200
Add access annotations to unistd.h
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/include/unistd.h b/include/unistd.h
@@ -41,6 +41,7 @@ extern "C" {
#undef ttyname_r
#undef write
+__access(write_only, 2, 3)
_FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __l)
{
size_t __b = __bos(__s, 0);
@@ -51,6 +52,7 @@ _FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __
return __r;
}
+__access(write_only, 1, 2)
_FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l)
{
size_t __b = __bos(__s, 0);
@@ -62,6 +64,7 @@ _FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l)
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
#undef getdomainname
+__access(write_only, 1, 2)
_FORTIFY_FN(getdomainname) int getdomainname(char * _FORTIFY_POS0 __s, size_t __l)
{
size_t __b = __bos(__s, 0);
@@ -81,6 +84,7 @@ _FORTIFY_FN(getgroups) int getgroups(int __l, gid_t * _FORTIFY_POS0 __s)
return __orig_getgroups(__l, __s);
}
+__access(write_only, 1, 2)
_FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l)
{
size_t __b = __bos(__s, 0);
@@ -90,6 +94,7 @@ _FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l)
return __orig_gethostname(__s, __l);
}
+__access(write_only, 1, 2)
_FORTIFY_FN(getlogin_r) int getlogin_r(char * _FORTIFY_POS0 __s, size_t __l)
{
size_t __b = __bos(__s, 0);
@@ -109,6 +114,7 @@ _FORTIFY_FN(pread) ssize_t pread(int __f, void * _FORTIFY_POS0 __s,
return __orig_pread(__f, __s, __n, __o);
}
+__access(write_only, 2, 3)
_FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n)
{
size_t __b = __bos(__s, 0);
@@ -118,6 +124,7 @@ _FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n)
return __orig_read(__f, __s, __n);
}
+__access(write_only, 2, 3)
_FORTIFY_FN(readlink) ssize_t readlink(const char *__p,
char * _FORTIFY_POS0 __s, size_t __n)
{
@@ -128,6 +135,7 @@ _FORTIFY_FN(readlink) ssize_t readlink(const char *__p,
return __orig_readlink(__p, __s, __n);
}
+__access(write_only, 3, 4)
_FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p,
char * _FORTIFY_POS0 __s, size_t __n)
{
@@ -138,6 +146,7 @@ _FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p,
return __orig_readlinkat(__f, __p, __s, __n);
}
+__access(write_only, 2, 3)
_FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s,
size_t __n)
{
@@ -148,6 +157,7 @@ _FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s,
return __orig_ttyname_r(__f, __s, __n);
}
+__access(read_only, 2, 3)
_FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s,
size_t __n)
{