summaryrefslogtreecommitdiff
path: root/include/unistd.h
diff options
context:
space:
mode:
authorjvoisin2025-11-12 22:28:13 +0100
committerjvoisin2025-11-14 13:55:31 +0100
commitbf242b15e1f7873bdb940c2441b5e57747bc2f81 (patch)
treedd80ee51edf4542b65a9e49db369dc44d089c359 /include/unistd.h
parentc93890993aded39be2f8f820fb19d8efe2cd9184 (diff)
Add `access` annotations
Diffstat (limited to 'include/unistd.h')
-rw-r--r--include/unistd.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h
index 4c18b73..a6c2ed1 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -41,6 +41,7 @@ extern "C" {
41#undef ttyname_r 41#undef ttyname_r
42#undef write 42#undef write
43 43
44__access(write_only, 2, 3)
44_FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __l) 45_FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __l)
45{ 46{
46 size_t __b = __bos(__s, 0); 47 size_t __b = __bos(__s, 0);
@@ -51,6 +52,7 @@ _FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __
51 return __r; 52 return __r;
52} 53}
53 54
55__access(write_only, 1, 2)
54_FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l) 56_FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l)
55{ 57{
56 size_t __b = __bos(__s, 0); 58 size_t __b = __bos(__s, 0);
@@ -62,6 +64,7 @@ _FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l)
62 64
63#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 65#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
64#undef getdomainname 66#undef getdomainname
67__access(write_only, 1, 2)
65_FORTIFY_FN(getdomainname) int getdomainname(char * _FORTIFY_POS0 __s, size_t __l) 68_FORTIFY_FN(getdomainname) int getdomainname(char * _FORTIFY_POS0 __s, size_t __l)
66{ 69{
67 size_t __b = __bos(__s, 0); 70 size_t __b = __bos(__s, 0);
@@ -81,6 +84,7 @@ _FORTIFY_FN(getgroups) int getgroups(int __l, gid_t * _FORTIFY_POS0 __s)
81 return __orig_getgroups(__l, __s); 84 return __orig_getgroups(__l, __s);
82} 85}
83 86
87__access(write_only, 1, 2)
84_FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l) 88_FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l)
85{ 89{
86 size_t __b = __bos(__s, 0); 90 size_t __b = __bos(__s, 0);
@@ -90,6 +94,7 @@ _FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l)
90 return __orig_gethostname(__s, __l); 94 return __orig_gethostname(__s, __l);
91} 95}
92 96
97__access(write_only, 1, 2)
93_FORTIFY_FN(getlogin_r) int getlogin_r(char * _FORTIFY_POS0 __s, size_t __l) 98_FORTIFY_FN(getlogin_r) int getlogin_r(char * _FORTIFY_POS0 __s, size_t __l)
94{ 99{
95 size_t __b = __bos(__s, 0); 100 size_t __b = __bos(__s, 0);
@@ -109,6 +114,7 @@ _FORTIFY_FN(pread) ssize_t pread(int __f, void * _FORTIFY_POS0 __s,
109 return __orig_pread(__f, __s, __n, __o); 114 return __orig_pread(__f, __s, __n, __o);
110} 115}
111 116
117__access(write_only, 2, 3)
112_FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n) 118_FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n)
113{ 119{
114 size_t __b = __bos(__s, 0); 120 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)
118 return __orig_read(__f, __s, __n); 124 return __orig_read(__f, __s, __n);
119} 125}
120 126
127__access(write_only, 2, 3)
121_FORTIFY_FN(readlink) ssize_t readlink(const char *__p, 128_FORTIFY_FN(readlink) ssize_t readlink(const char *__p,
122 char * _FORTIFY_POS0 __s, size_t __n) 129 char * _FORTIFY_POS0 __s, size_t __n)
123{ 130{
@@ -128,6 +135,7 @@ _FORTIFY_FN(readlink) ssize_t readlink(const char *__p,
128 return __orig_readlink(__p, __s, __n); 135 return __orig_readlink(__p, __s, __n);
129} 136}
130 137
138__access(write_only, 3, 4)
131_FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p, 139_FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p,
132 char * _FORTIFY_POS0 __s, size_t __n) 140 char * _FORTIFY_POS0 __s, size_t __n)
133{ 141{
@@ -138,6 +146,7 @@ _FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p,
138 return __orig_readlinkat(__f, __p, __s, __n); 146 return __orig_readlinkat(__f, __p, __s, __n);
139} 147}
140 148
149__access(write_only, 2, 3)
141_FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s, 150_FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s,
142 size_t __n) 151 size_t __n)
143{ 152{
@@ -148,6 +157,7 @@ _FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s,
148 return __orig_ttyname_r(__f, __s, __n); 157 return __orig_ttyname_r(__f, __s, __n);
149} 158}
150 159
160__access(read_only, 2, 3)
151_FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s, 161_FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s,
152 size_t __n) 162 size_t __n)
153{ 163{