tree: https://github.com/ammarfaizi2/linux-block crng/random/vdso head: f1dcde1339efb8adc21b29142bfbdb8a026348d0 commit: 030205da92b1beb7f36a238d06486cf74dd15b2a [20/22] random: add vgetrandom_alloc() syscall config: arc-randconfig-r043-20221127 compiler: arceb-elf-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/ammarfaizi2/linux-block/commit/030205da92b1beb7f36a238d06486cf74dd15b2a git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block git fetch --no-tags ammarfaizi2-block crng/random/vdso git checkout 030205da92b1beb7f36a238d06486cf74dd15b2a # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/char/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All warnings (new ones prefixed by >>): drivers/char/random.c:201: warning: bad line: >> drivers/char/random.c:207: warning: expecting prototype for vgetrandom_alloc(). Prototype was for sys_vgetrandom_alloc() instead vim +207 drivers/char/random.c 166 167 #define warn_unseeded_randomness() \ 168 if (IS_ENABLED(CONFIG_WARN_ALL_UNSEEDED_RANDOM) && !crng_ready()) \ 169 printk_deferred(KERN_NOTICE "random: %s called from %pS with crng_init=%d\n", \ 170 __func__, (void *)_RET_IP_, crng_init) 171 172 173 174 /******************************************************************** 175 * 176 * vDSO support helpers. 177 * 178 * The actual vDSO function is defined over in lib/vdso/getrandom.c, 179 * but this section contains the kernel-mode helpers to support that. 180 * 181 ********************************************************************/ 182 183 #if IS_ENABLED(CONFIG_VGETRANDOM_ALLOC_SYSCALL) 184 /** 185 * vgetrandom_alloc - allocate opaque states for use with vDSO getrandom(). 186 * 187 * @num: on input, a pointer to a suggested hint of how many states to 188 * allocate, and on output the number of states actually allocated. 189 * 190 * @size_per_each: the size of each state allocated, so that the caller can 191 * split up the returned allocation into individual states. 192 * 193 * @flags: currently always zero. 194 * 195 * The getrandom() vDSO function in userspace requires an opaque state, which 196 * this function allocates by mapping a certain number of special pages into 197 * the calling process. It takes a hint as to the number of opaque states 198 * desired, and provides the caller with the number of opaque states actually 199 * allocated, the size of each one in bytes, and the address of the first 200 * state. 201 202 * Returns a pointer to the first state in the allocation. 203 * 204 */ 205 SYSCALL_DEFINE3(vgetrandom_alloc, unsigned int __user *, num, 206 unsigned int __user *, size_per_each, unsigned int, flags) > 207 { 208 const size_t state_size = sizeof(struct vgetrandom_state); 209 size_t alloc_size, num_states; 210 unsigned long pages_addr; 211 unsigned int num_hint; 212 int ret; 213 214 if (flags) 215 return -EINVAL; 216 217 if (get_user(num_hint, num)) 218 return -EFAULT; 219 220 num_states = clamp_t(size_t, num_hint, 1, (SIZE_MAX & PAGE_MASK) / state_size); 221 alloc_size = PAGE_ALIGN(num_states * state_size); 222 223 if (put_user(alloc_size / state_size, num) || put_user(state_size, size_per_each)) 224 return -EFAULT; 225 226 pages_addr = vm_mmap(NULL, 0, alloc_size, PROT_READ | PROT_WRITE, 227 MAP_PRIVATE | MAP_ANONYMOUS | MAP_LOCKED, 0); 228 if (IS_ERR_VALUE(pages_addr)) 229 return pages_addr; 230 231 ret = do_madvise(current->mm, pages_addr, alloc_size, MADV_WIPEONFORK); 232 if (ret < 0) 233 goto err_unmap; 234 235 return pages_addr; 236 237 err_unmap: 238 vm_munmap(pages_addr, alloc_size); 239 return ret; 240 } 241 #endif 242 -- 0-DAY CI Kernel Test Service https://01.org/lkp