Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.21 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795976545; b=xFvg0cO9Bt/wHcjRdlHFeCqBzj1RREJxiDTL40OupmbmrDEZAMevXEuBQ/oR3o2wQA2L FHcQ0yFRlcW0CQk+hrrHnxpst4FS98g4DtZ95h5WvGnBJCfQrvtoQcPLPLIKiB71AUNc4 I2r/D9LwOX5Wgw2unukTPgjd1OQdTOAlxndh4ni/Z0HN9fWa1Hn2ppYtfUpVO5uXRHZWv VwRjD6Gjssa0hoT8TNBGwFWWuIqhTv3P5UfjJvhAad3wcYWvZgg92P4P5I14sBHP61hvl c7tzbbENLKYbcnuzKzRM9E2I5GwxiREkRON0aZFaFSy9lSs7sUDVi1epVVsw3IImQtg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795976545; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Date:From:To: Cc:Subject:Message-ID:User-Agent; bh=O8NJ4udMyLJZyxy9dRtMEYmOKRPK0u8EWsF889qBQQ0=; b=13N0H0g2wi/FoyRiF0SaWiRlG6p63NwRntXyVQ9LnvSF3bKcAXjEFlTrJo4QEZoV79+b A3P6zRcfwbQgPDdDoHQ4hS50W2FYKvkMh1eKAqGOKkbkpJHZR53c8fX+lXwBsbb4opWsT uMr3KxKFX/HRAmQmgA7i/U9oowjO0dy6VveWEyz+Yskga+4HJbKry7d1M1dKpPEE23IlL LealvEGLcqi4o+AJvO38UdboWS0qyfiOtq89X87qrnlnxuzdIP2FsFqtqiBI3aOfLxwPN Y+zkA8OwrIMTgtC5k3mLLa6CV4HqXA2334oJwX6RfvZwutdZH+KPPH5hfH/awiGLYow== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=mIcR5oHg; arc=none smtp.remote-ip=198.175.65.21 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 972BE606A31C for ; Sun, 29 Nov 2026 18:22:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 972BE606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=mIcR5oHg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1795976544; x=1827512544; h=date:from:to:cc:subject:message-id; bh=119tevH5legEcg+euzjEhck4qLnj7NDlYlTOs08hmE4=; b=mIcR5oHgvu/Q3goNtyS5GJFyTgqnJ5pNfB9DH2AQ/NaQ7yn+RLksF0SP wm+gHohuDmrIqNNvZaDGTeNO9r9WYnTs1bZLJOJwCTCya3anhJrd8alYJ 5JSpYFuh0Ryv/mhiz643C/S+qOS9qoOkrhzu7bKvvUt9kUHilKVpDaFhU sziMJ/dzUCnrccnYX4Rv3Ar7aqDf6WDic+76VgjpFfVDV1v9KKTfXQSIW LNFhvjx/yqFxlGPKOdNzQLSUwpHtGHCfgPD23LvxJpo/jUTWzJIB2In/E 5ZG4Wcc8ZQTAunHjxRKb90hgENSrDAMGvc7X0tCKta4frrMdDY058mG5i A==; X-CSE-ConnectionGUID: T5VX9YJtT3qEwhaWRFeueA== X-CSE-MsgGUID: yj2n5TU8Q6Ks2Kxr7ICetQ== X-IronPort-AV: E=McAfee;i="6800,10657,11981"; a="4901846" X-IronPort-AV: E=Sophos;i="6.27,241,1787036400"; d="scan'208";a="4901846" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2026 10:22:23 -0800 X-CSE-ConnectionGUID: UYW/yckKQluYzufn6MFzbg== X-CSE-MsgGUID: aASmoYc/QXa1AGMYm/0InQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,241,1787036400"; d="scan'208";a="13304562" Received: from igk-lkp-server01.igk.intel.com (HELO 146cf1e082f1) ([10.211.93.152]) by fmviesa001.fm.intel.com with ESMTP; 29 Nov 2026 10:22:21 -0800 Received: from kbuild by 146cf1e082f1 with local (Exim 4.98.2) (envelope-from ) id 1xXjXX-0000000016Y-1jVB; Sun, 29 Nov 2026 18:22:19 +0000 Date: Sun, 29 Nov 2026 19:22:12 +0100 From: kernel test robot To: Kumar Kartikeya Dwivedi Cc: oe-kbuild-all@lists.linux.dev Subject: [kkdwivedi:fermata 72/444] kernel/bpf/sys_call.c:76:9: error: '__NR_newfstatat' undeclared here (not in a function) Message-ID: <20261129192042.OTVczPZg-lkp@intel.com> User-Agent: s-nail v14.9.25 X-Mailing-List: oe-kbuild-all@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list tree: https://github.com/kkdwivedi/linux fermata head: a93b167d1893f89b1b1e647dac9b51925f94c2e5 commit: 330e827fdc977bf8b90c4bba9780325bacc27474 [72/444] bpf: Let a syscall program make system calls for its process's threads config: um-randconfig-r2105-20261129 (https://download.01.org/0day-ci/archive/20261129/20261129192042.OTVczPZg-lkp@intel.com/config) compiler: gcc-12 (Debian 12.4.0-5) 12.4.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261129/20261129192042.OTVczPZg-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/20261129192042.OTVczPZg-lkp@intel.com/ All error/warnings (new ones prefixed by >>): >> kernel/bpf/sys_call.c:76:9: error: '__NR_newfstatat' undeclared here (not in a function) 76 | __NR_newfstatat, __NR_statx, __NR_statfs, __NR_fstatfs, __NR_access, __NR_faccessat, | ^~~~~~~~~~~~~~~ >> kernel/bpf/sys_call.c:82:63: error: '__NR_accept' undeclared here (not in a function); did you mean '__sys_accept4'? 82 | __NR_socket, __NR_socketpair, __NR_bind, __NR_listen, __NR_accept, __NR_accept4, | ^~~~~~~~~~~ | __sys_accept4 kernel/bpf/sys_call.c: In function 'bpf_sys_call': kernel/bpf/sys_call.c:218:13: error: 'struct pt_regs' has no member named 'orig_ax' 218 | regs.orig_ax = nr; | ^ kernel/bpf/sys_call.c:219:13: error: 'struct pt_regs' has no member named 'di' 219 | regs.di = args[0]; | ^ kernel/bpf/sys_call.c:220:13: error: 'struct pt_regs' has no member named 'si' 220 | regs.si = args[1]; | ^ kernel/bpf/sys_call.c:221:13: error: 'struct pt_regs' has no member named 'dx' 221 | regs.dx = args[2]; | ^ kernel/bpf/sys_call.c:222:13: error: 'struct pt_regs' has no member named 'r10' 222 | regs.r10 = args[3]; | ^ kernel/bpf/sys_call.c:223:13: error: 'struct pt_regs' has no member named 'r8' 223 | regs.r8 = args[4]; | ^ kernel/bpf/sys_call.c:224:13: error: 'struct pt_regs' has no member named 'r9' 224 | regs.r9 = args[5]; | ^ >> kernel/bpf/sys_call.c:243:34: warning: passing argument 1 of 'sys_call_table[nr]' makes integer from pointer without a cast [-Wint-conversion] 243 | ret = sys_call_table[nr](®s); | ^~~~~ | | | struct pt_regs * kernel/bpf/sys_call.c:243:34: note: expected 'long unsigned int' but argument is of type 'struct pt_regs *' kernel/bpf/sys_call.c:243:15: error: too few arguments to function 'sys_call_table[nr]' 243 | ret = sys_call_table[nr](®s); | ^~~~~~~~~~~~~~ vim +/__NR_newfstatat +76 kernel/bpf/sys_call.c 66 67 /* Calls for any thread of the process. */ 68 static const u16 bpf_sys_call_process[] __initconst = { 69 __NR_read, __NR_write, __NR_pread64, __NR_pwrite64, __NR_readv, __NR_writev, 70 __NR_preadv, __NR_pwritev, __NR_preadv2, __NR_pwritev2, 71 __NR_sendfile, __NR_splice, __NR_tee, __NR_copy_file_range, 72 __NR_lseek, __NR_close, __NR_dup, __NR_dup2, __NR_dup3, __NR_fcntl, __NR_flock, 73 __NR_fsync, __NR_fdatasync, __NR_sync_file_range, __NR_truncate, __NR_ftruncate, 74 __NR_fallocate, __NR_fadvise64, 75 __NR_open, __NR_openat, __NR_openat2, __NR_creat, __NR_stat, __NR_fstat, __NR_lstat, > 76 __NR_newfstatat, __NR_statx, __NR_statfs, __NR_fstatfs, __NR_access, __NR_faccessat, 77 __NR_faccessat2, __NR_getdents64, __NR_getcwd, __NR_mkdir, __NR_mkdirat, __NR_rmdir, 78 __NR_unlink, __NR_unlinkat, __NR_rename, __NR_renameat, __NR_renameat2, __NR_link, 79 __NR_linkat, __NR_symlink, __NR_symlinkat, __NR_readlink, __NR_readlinkat, 80 __NR_chmod, __NR_fchmod, __NR_fchmodat, __NR_chown, __NR_fchown, __NR_lchown, 81 __NR_fchownat, __NR_utimensat, __NR_memfd_create, > 82 __NR_socket, __NR_socketpair, __NR_bind, __NR_listen, __NR_accept, __NR_accept4, 83 __NR_connect, __NR_shutdown, __NR_sendto, __NR_recvfrom, __NR_sendmsg, __NR_recvmsg, 84 __NR_sendmmsg, __NR_recvmmsg, __NR_setsockopt, __NR_getsockopt, __NR_getsockname, 85 __NR_getpeername, 86 __NR_pipe, __NR_pipe2, __NR_eventfd, __NR_eventfd2, __NR_epoll_create, 87 __NR_epoll_create1, __NR_epoll_ctl, __NR_epoll_wait, __NR_poll, __NR_select, 88 __NR_mmap, __NR_munmap, __NR_mprotect, __NR_madvise, __NR_mremap, __NR_msync, 89 __NR_mincore, __NR_mlock, __NR_munlock, __NR_brk, 90 __NR_getpid, __NR_getppid, __NR_getuid, __NR_geteuid, __NR_getgid, __NR_getegid, 91 __NR_getrandom, __NR_uname, __NR_sysinfo, __NR_clock_gettime, __NR_clock_getres, 92 __NR_gettimeofday, __NR_time, 93 }; 94 95 /* 96 * Calls for the calling thread only: made for another one, they would wait, 97 * sleep, move or answer for the wrong thread, or record its id as an owner. 98 */ 99 static const u16 bpf_sys_call_self[] __initconst = { 100 __NR_futex, __NR_gettid, __NR_getcpu, __NR_getrusage, __NR_sched_yield, 101 __NR_sched_setaffinity, __NR_sched_getaffinity, __NR_nanosleep, __NR_clock_nanosleep, 102 }; 103 104 static DECLARE_BITMAP(bpf_sys_call_for_process, NR_syscalls) __ro_after_init; 105 static DECLARE_BITMAP(bpf_sys_call_for_self, NR_syscalls) __ro_after_init; 106 107 /* 108 * Whether @task has what a call made by the current thread would use in its 109 * place: the file table, the fs and the namespaces, and no filter or audit 110 * that the call would pass by. The pointers are compared, not followed: each 111 * changes only by its own thread, and a call that raced with such a change 112 * was made before it. 113 */ 114 /* struct seccomp has no mode without CONFIG_SECCOMP, and no task a filter */ 115 static bool bpf_sys_call_seccomp(struct task_struct *task) 116 { 117 #ifdef CONFIG_SECCOMP 118 return READ_ONCE(task->seccomp.mode); 119 #else 120 return false; 121 #endif 122 } 123 124 static int bpf_sys_call_check(struct task_struct *task) 125 { 126 if (task != current) { 127 if (!same_thread_group(task, current)) 128 return -EPERM; 129 if (READ_ONCE(task->flags) & PF_EXITING) 130 return -ESRCH; 131 if (READ_ONCE(task->files) != current->files || 132 READ_ONCE(task->fs) != current->fs || 133 READ_ONCE(task->nsproxy) != current->nsproxy) 134 return -EPERM; 135 } 136 if (bpf_sys_call_seccomp(current) || bpf_sys_call_seccomp(task)) 137 return -EPERM; 138 if (!audit_dummy_context()) 139 return -EPERM; 140 return 0; 141 } 142 143 /* 144 * The work that the return to user mode would run for the calling thread: 145 * the release of a file whose last reference a call dropped, above all, 146 * which would otherwise wait until the thread leaves the program. io threads run theirs 147 * the same way, see io_run_task_work(). 148 */ 149 static void bpf_sys_call_task_work(void) 150 { 151 if (test_thread_flag(TIF_NOTIFY_SIGNAL)) 152 clear_notify_signal(); 153 if (task_work_pending(current)) { 154 __set_current_state(TASK_RUNNING); 155 task_work_run(); 156 } 157 } 158 159 __bpf_kfunc_start_defs(); 160 161 /** 162 * bpf_sys_call - Make a system call for a thread of the caller's process 163 * @task: the thread the call is made for, the calling thread or another one 164 * of its process 165 * @nr: the system call's number 166 * @args: its six arguments 167 * @args__sz: the size of @args, 48 168 * @aux: the calling program, set by the verifier 169 * 170 * Makes system call @nr in the calling thread, a thread of a user process 171 * running a syscall program, as @task would make it: see the comment at the 172 * top for what is the task's and what is refused. Pointers in @args are user 173 * addresses of the process. 174 * 175 * For the verifier the call is a park, see bpf_task_park(): the program 176 * leaves its Tasks Trace RCU read section and may migrate for the time of the 177 * call, which may sleep for as long as the system call does, and the time 178 * slice of its loops starts over when it returns. 179 * 180 * Signals are delivered on the return to user mode, which the call does not 181 * make. A call that a signal interrupted returns -ERESTARTSYS, 182 * -ERESTARTNOINTR, -ERESTARTNOHAND or -ERESTART_RESTARTBLOCK, as the system 183 * call gave it: it did nothing, and the program makes it again once the 184 * thread has been to user mode, or completes it with -EINTR. The program does 185 * not hand those codes to user space. A call is not begun while a signal is 186 * pending: that returns -ERESTARTNOINTR. Work queued for the thread's return 187 * to user mode, the release of a file whose last reference a call dropped 188 * among it, is run before and after the call. 189 * 190 * Return: what the system call returned, or -EINVAL if @args__sz is not 48, 191 * -ENOSYS if @nr is not a call that may be made for @task, -EPERM if the 192 * calling thread is not a thread of a user process, @task is not of its 193 * process or does not have its files, fs or namespaces, or a seccomp filter 194 * or syscall auditing applies, -ESRCH if @task is exiting, and 195 * -ERESTARTNOINTR if a signal is pending. 196 */ 197 __bpf_kfunc long bpf_sys_call(struct task_struct *task, u32 nr, const u64 *args, u32 args__sz, 198 struct bpf_prog_aux *aux) 199 { 200 const struct cred *cred = NULL, *old; 201 struct pt_regs regs = {}; 202 long ret; 203 204 if (args__sz != 6 * sizeof(u64)) 205 return -EINVAL; 206 if (!current->mm || (current->flags & (PF_KTHREAD | PF_USER_WORKER))) 207 return -EPERM; 208 if (nr >= NR_syscalls) 209 return -ENOSYS; 210 nr = array_index_nospec(nr, NR_syscalls); 211 if (!test_bit(nr, bpf_sys_call_for_process) && 212 !(task == current && test_bit(nr, bpf_sys_call_for_self))) 213 return -ENOSYS; 214 ret = bpf_sys_call_check(task); 215 if (ret) 216 return ret; 217 218 regs.orig_ax = nr; 219 regs.di = args[0]; 220 regs.si = args[1]; 221 regs.dx = args[2]; 222 regs.r10 = args[3]; 223 regs.r8 = args[4]; 224 regs.r9 = args[5]; 225 226 /* What bpf_task_park() does for its sleep, and for the same reasons. */ 227 migrate_enable(); 228 rcu_read_unlock_trace(); 229 230 bpf_sys_call_task_work(); 231 if (signal_pending(current)) { 232 ret = -ERESTARTNOINTR; 233 goto out; 234 } 235 /* 236 * The task's objective credentials: its subjective ones may be an 237 * override that a call of its own made for itself for a while. 238 */ 239 if (task != current && rcu_access_pointer(task->real_cred) != current_cred()) 240 cred = get_task_cred(task); 241 if (cred) 242 old = override_creds(cred); > 243 ret = sys_call_table[nr](®s); 244 if (cred) { 245 revert_creds(old); 246 put_cred(cred); 247 } 248 bpf_sys_call_task_work(); 249 out: 250 rcu_read_lock_trace(); 251 migrate_disable(); 252 bpf_timed_may_goto_rearm(aux); 253 return ret; 254 } 255 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki