Re: [PATCH] prctl: Don't compile some of prctl functions when CRUI

From: kbuild test robot
Date: Fri Apr 20 2018 - 16:38:03 EST


Hi Sergey,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.17-rc1 next-20180420]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Sergey-Senozhatsky/prctl-Don-t-compile-some-of-prctl-functions-when-CRUI/20180421-040826
config: i386-tinyconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All errors (new ones prefixed by >>):

kernel/sys.c: In function 'prctl_set_mm':
>> kernel/sys.c:2108:10: error: implicit declaration of function 'prctl_set_mm_exe_file'; did you mean 'set_mm_exe_file'? [-Werror=implicit-function-declaration]
return prctl_set_mm_exe_file(mm, (unsigned int)addr);
^~~~~~~~~~~~~~~~~~~~~
set_mm_exe_file
>> kernel/sys.c:2174:10: error: implicit declaration of function 'validate_prctl_map'; did you mean 'validate_creds'? [-Werror=implicit-function-declaration]
error = validate_prctl_map(&prctl_map);
^~~~~~~~~~~~~~~~~~
validate_creds
cc1: some warnings being treated as errors

vim +2108 kernel/sys.c

f606b77f1 Cyrill Gorcunov 2014-10-09 2103
79f0713d4 Cyrill Gorcunov 2012-03-15 2104 if (!capable(CAP_SYS_RESOURCE))
028ee4be3 Cyrill Gorcunov 2012-01-12 2105 return -EPERM;
028ee4be3 Cyrill Gorcunov 2012-01-12 2106
6e399cd14 Davidlohr Bueso 2015-04-16 2107 if (opt == PR_SET_MM_EXE_FILE)
6e399cd14 Davidlohr Bueso 2015-04-16 @2108 return prctl_set_mm_exe_file(mm, (unsigned int)addr);
b32dfe377 Cyrill Gorcunov 2012-05-31 2109
4a00e9df2 Alexey Dobriyan 2015-06-25 2110 if (opt == PR_SET_MM_AUXV)
4a00e9df2 Alexey Dobriyan 2015-06-25 2111 return prctl_set_auxv(mm, addr, arg4);
4a00e9df2 Alexey Dobriyan 2015-06-25 2112
1ad75b9e1 Cyrill Gorcunov 2012-06-07 2113 if (addr >= TASK_SIZE || addr < mmap_min_addr)
028ee4be3 Cyrill Gorcunov 2012-01-12 2114 return -EINVAL;
028ee4be3 Cyrill Gorcunov 2012-01-12 2115
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2116 error = -EINVAL;
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2117
ddf1d398e Mateusz Guzik 2016-01-20 2118 down_write(&mm->mmap_sem);
028ee4be3 Cyrill Gorcunov 2012-01-12 2119 vma = find_vma(mm, addr);
028ee4be3 Cyrill Gorcunov 2012-01-12 2120
4a00e9df2 Alexey Dobriyan 2015-06-25 2121 prctl_map.start_code = mm->start_code;
4a00e9df2 Alexey Dobriyan 2015-06-25 2122 prctl_map.end_code = mm->end_code;
4a00e9df2 Alexey Dobriyan 2015-06-25 2123 prctl_map.start_data = mm->start_data;
4a00e9df2 Alexey Dobriyan 2015-06-25 2124 prctl_map.end_data = mm->end_data;
4a00e9df2 Alexey Dobriyan 2015-06-25 2125 prctl_map.start_brk = mm->start_brk;
4a00e9df2 Alexey Dobriyan 2015-06-25 2126 prctl_map.brk = mm->brk;
4a00e9df2 Alexey Dobriyan 2015-06-25 2127 prctl_map.start_stack = mm->start_stack;
4a00e9df2 Alexey Dobriyan 2015-06-25 2128 prctl_map.arg_start = mm->arg_start;
4a00e9df2 Alexey Dobriyan 2015-06-25 2129 prctl_map.arg_end = mm->arg_end;
4a00e9df2 Alexey Dobriyan 2015-06-25 2130 prctl_map.env_start = mm->env_start;
4a00e9df2 Alexey Dobriyan 2015-06-25 2131 prctl_map.env_end = mm->env_end;
4a00e9df2 Alexey Dobriyan 2015-06-25 2132 prctl_map.auxv = NULL;
4a00e9df2 Alexey Dobriyan 2015-06-25 2133 prctl_map.auxv_size = 0;
4a00e9df2 Alexey Dobriyan 2015-06-25 2134 prctl_map.exe_fd = -1;
4a00e9df2 Alexey Dobriyan 2015-06-25 2135
028ee4be3 Cyrill Gorcunov 2012-01-12 2136 switch (opt) {
028ee4be3 Cyrill Gorcunov 2012-01-12 2137 case PR_SET_MM_START_CODE:
4a00e9df2 Alexey Dobriyan 2015-06-25 2138 prctl_map.start_code = addr;
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2139 break;
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2140 case PR_SET_MM_END_CODE:
4a00e9df2 Alexey Dobriyan 2015-06-25 2141 prctl_map.end_code = addr;
028ee4be3 Cyrill Gorcunov 2012-01-12 2142 break;
028ee4be3 Cyrill Gorcunov 2012-01-12 2143 case PR_SET_MM_START_DATA:
4a00e9df2 Alexey Dobriyan 2015-06-25 2144 prctl_map.start_data = addr;
028ee4be3 Cyrill Gorcunov 2012-01-12 2145 break;
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2146 case PR_SET_MM_END_DATA:
4a00e9df2 Alexey Dobriyan 2015-06-25 2147 prctl_map.end_data = addr;
4a00e9df2 Alexey Dobriyan 2015-06-25 2148 break;
4a00e9df2 Alexey Dobriyan 2015-06-25 2149 case PR_SET_MM_START_STACK:
4a00e9df2 Alexey Dobriyan 2015-06-25 2150 prctl_map.start_stack = addr;
028ee4be3 Cyrill Gorcunov 2012-01-12 2151 break;
028ee4be3 Cyrill Gorcunov 2012-01-12 2152 case PR_SET_MM_START_BRK:
4a00e9df2 Alexey Dobriyan 2015-06-25 2153 prctl_map.start_brk = addr;
028ee4be3 Cyrill Gorcunov 2012-01-12 2154 break;
028ee4be3 Cyrill Gorcunov 2012-01-12 2155 case PR_SET_MM_BRK:
4a00e9df2 Alexey Dobriyan 2015-06-25 2156 prctl_map.brk = addr;
4a00e9df2 Alexey Dobriyan 2015-06-25 2157 break;
4a00e9df2 Alexey Dobriyan 2015-06-25 2158 case PR_SET_MM_ARG_START:
4a00e9df2 Alexey Dobriyan 2015-06-25 2159 prctl_map.arg_start = addr;
4a00e9df2 Alexey Dobriyan 2015-06-25 2160 break;
4a00e9df2 Alexey Dobriyan 2015-06-25 2161 case PR_SET_MM_ARG_END:
4a00e9df2 Alexey Dobriyan 2015-06-25 2162 prctl_map.arg_end = addr;
4a00e9df2 Alexey Dobriyan 2015-06-25 2163 break;
4a00e9df2 Alexey Dobriyan 2015-06-25 2164 case PR_SET_MM_ENV_START:
4a00e9df2 Alexey Dobriyan 2015-06-25 2165 prctl_map.env_start = addr;
4a00e9df2 Alexey Dobriyan 2015-06-25 2166 break;
4a00e9df2 Alexey Dobriyan 2015-06-25 2167 case PR_SET_MM_ENV_END:
4a00e9df2 Alexey Dobriyan 2015-06-25 2168 prctl_map.env_end = addr;
4a00e9df2 Alexey Dobriyan 2015-06-25 2169 break;
4a00e9df2 Alexey Dobriyan 2015-06-25 2170 default:
028ee4be3 Cyrill Gorcunov 2012-01-12 2171 goto out;
4a00e9df2 Alexey Dobriyan 2015-06-25 2172 }
028ee4be3 Cyrill Gorcunov 2012-01-12 2173
4a00e9df2 Alexey Dobriyan 2015-06-25 @2174 error = validate_prctl_map(&prctl_map);
4a00e9df2 Alexey Dobriyan 2015-06-25 2175 if (error)
028ee4be3 Cyrill Gorcunov 2012-01-12 2176 goto out;
028ee4be3 Cyrill Gorcunov 2012-01-12 2177
4a00e9df2 Alexey Dobriyan 2015-06-25 2178 switch (opt) {
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2179 /*
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2180 * If command line arguments and environment
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2181 * are placed somewhere else on stack, we can
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2182 * set them up here, ARG_START/END to setup
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2183 * command line argumets and ENV_START/END
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2184 * for environment.
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2185 */
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2186 case PR_SET_MM_START_STACK:
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2187 case PR_SET_MM_ARG_START:
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2188 case PR_SET_MM_ARG_END:
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2189 case PR_SET_MM_ENV_START:
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2190 case PR_SET_MM_ENV_END:
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2191 if (!vma) {
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2192 error = -EFAULT;
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2193 goto out;
fe8c7f5cb Cyrill Gorcunov 2012-05-31 2194 }
028ee4be3 Cyrill Gorcunov 2012-01-12 2195 }
028ee4be3 Cyrill Gorcunov 2012-01-12 2196
4a00e9df2 Alexey Dobriyan 2015-06-25 2197 mm->start_code = prctl_map.start_code;
4a00e9df2 Alexey Dobriyan 2015-06-25 2198 mm->end_code = prctl_map.end_code;
4a00e9df2 Alexey Dobriyan 2015-06-25 2199 mm->start_data = prctl_map.start_data;
4a00e9df2 Alexey Dobriyan 2015-06-25 2200 mm->end_data = prctl_map.end_data;
4a00e9df2 Alexey Dobriyan 2015-06-25 2201 mm->start_brk = prctl_map.start_brk;
4a00e9df2 Alexey Dobriyan 2015-06-25 2202 mm->brk = prctl_map.brk;
4a00e9df2 Alexey Dobriyan 2015-06-25 2203 mm->start_stack = prctl_map.start_stack;
4a00e9df2 Alexey Dobriyan 2015-06-25 2204 mm->arg_start = prctl_map.arg_start;
4a00e9df2 Alexey Dobriyan 2015-06-25 2205 mm->arg_end = prctl_map.arg_end;
4a00e9df2 Alexey Dobriyan 2015-06-25 2206 mm->env_start = prctl_map.env_start;
4a00e9df2 Alexey Dobriyan 2015-06-25 2207 mm->env_end = prctl_map.env_end;
4a00e9df2 Alexey Dobriyan 2015-06-25 2208
028ee4be3 Cyrill Gorcunov 2012-01-12 2209 error = 0;
028ee4be3 Cyrill Gorcunov 2012-01-12 2210 out:
ddf1d398e Mateusz Guzik 2016-01-20 2211 up_write(&mm->mmap_sem);
028ee4be3 Cyrill Gorcunov 2012-01-12 2212 return error;
028ee4be3 Cyrill Gorcunov 2012-01-12 2213 }
300f786b2 Cyrill Gorcunov 2012-06-07 2214

:::::: The code at line 2108 was first introduced by commit
:::::: 6e399cd144d8500ffb5d40fa6848890e2580a80a prctl: avoid using mmap_sem for exe_file serialization

:::::: TO: Davidlohr Bueso <dave@xxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip