Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\sys.c Create Date:2022-07-28 09:21:30
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:SYSCALL_DEFINE5

Proto:SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, unsigned long, arg4, unsigned long, arg5)

Type:

Parameter:Nothing

2267  me = current process
2271  error = security_task_prctl(option, arg2, arg3, arg4, arg5)
2272  If error != -ENOSYS Then Return error
2275  error = 0
2277  Case option == Second arg is a signal
2279  error = -EINVAL
2280  Break
2282  The signal sent when the parent dies = arg2
2283  Break
2284  Case option == Second arg is a ptr to return the signal
2285  error = Write a simple value into user space(The signal sent when the parent dies, (int__user * )arg2)
2286  Break
2287  Case option == Get/set current->mm->dumpable
2288  error = get_dumpable(mm)
2289  Break
2290  Case option == PR_SET_DUMPABLE
2292  error = -EINVAL
2293  Break
2295  set_dumpable(mm, arg2)
2296  Break
2298  Case option == PR_SET_UNALIGN
2299  error = SET_UNALIGN_CTL(me, arg2)
2300  Break
2301  Case option == Get/set unaligned access control bits (if meaningful)
2302  error = GET_UNALIGN_CTL(me, arg2)
2303  Break
2304  Case option == PR_SET_FPEMU
2305  error = SET_FPEMU_CTL(me, arg2)
2306  Break
2307  Case option == Get/set floating-point emulation control bits (if meaningful)
2308  error = GET_FPEMU_CTL(me, arg2)
2309  Break
2310  Case option == PR_SET_FPEXC
2311  error = SET_FPEXC_CTL(me, arg2)
2312  Break
2313  Case option == Get/set floating-point exception mode (if meaningful)
2314  error = GET_FPEXC_CTL(me, arg2)
2315  Break
2316  Case option == Get/set whether we use statistical process timing or accurate timestamp* based process timing
2317  error = Normal, traditional,statistical process timing
2318  Break
2319  Case option == PR_SET_TIMING
2320  If arg2 != Normal, traditional,statistical process timing Then error = -EINVAL
2322  Break
2323  Case option == Set process name
2324  comm[ size of * executable name, excluding path. * - normally initialized setup_new_exec() * - access it with [gs]et_task_comm() * - lock it with task_lock() - 1] = 0
2325  If Copy a NUL terminated string from userspace < 0 Then Return -EFAULT
2328  set_task_comm(me, comm)
2329  proc_comm_connector(me)
2330  Break
2331  Case option == Get process name
2332  get_task_comm(comm, me)
2333  If copy_to_user((char__user * )arg2, comm, size of comm ) Then Return -EFAULT
2335  Break
2336  Case option == Get/set process endian
2337  error = GET_ENDIAN(me, arg2)
2338  Break
2339  Case option == PR_SET_ENDIAN
2340  error = SET_ENDIAN(me, arg2)
2341  Break
2342  Case option == Get/set process seccomp mode
2343  error = prctl_get_seccomp()
2344  Break
2345  Case option == PR_SET_SECCOMP
2346  error = prctl_set_seccomp(arg2, (char__user * )arg3)
2347  Break
2348  Case option == Get/set the process' ability to use the timestamp counter instruction
2349  error = Get/set a process' ability to use the timestamp counter instruction (arg2)
2350  Break
2351  Case option == PR_SET_TSC
2352  error = SET_TSC_CTL(arg2)
2353  Break
2354  Case option == PR_TASK_PERF_EVENTS_DISABLE
2355  error = perf_event_task_disable()
2356  Break
2357  Case option == PR_TASK_PERF_EVENTS_ENABLE
2358  error = perf_event_task_enable()
2359  Break
2360  Case option == PR_GET_TIMERSLACK
2361  If timer_slack_ns > ULONG_MAX Then error = ULONG_MAX
2363  Else error = timer_slack_ns
2365  Break
2366  Case option == Get/set the timerslack as used by poll/select/nanosleep* A value of 0 means "use default"
2367  If arg2 <= 0 Then timer_slack_ns = default_timer_slack_ns
2370  Else timer_slack_ns = arg2
2372  Break
2373  Case option == Set early/late kill mode for hwpoison memory corruption.* This influences when the process gets killed on a memory corruption.
2374  If arg4 | arg5 Then Return -EINVAL
2377  Case arg2 == PR_MCE_KILL_CLEAR
2378  If arg3 != 0 Then Return -EINVAL
2381  Break
2382  Case arg2 == PR_MCE_KILL_SET
2391  Else Return -EINVAL
2393  Break
2394  Default
2395  Return -EINVAL
2397  Break
2398  Case option == PR_MCE_KILL_GET
2399  If arg2 | arg3 | arg4 | arg5 Then Return -EINVAL
2401  If flags & Process policy on mce errors Then error = If flags & Early kill for mce process policy Then PR_MCE_KILL_EARLY Else PR_MCE_KILL_LATE
2404  Else error = PR_MCE_KILL_DEFAULT
2406  Break
2407  Case option == Tune up process memory map specifics.
2408  error = prctl_set_mm(arg2, arg3, arg4, arg5)
2409  Break
2410  Case option == PR_GET_TID_ADDRESS
2411  error = prctl_get_tid_address(me, (int__user * * )arg2)
2412  Break
2413  Case option == PR_SET_CHILD_SUBREAPER
2414  is_child_subreaper = Not Not arg2
2415  If Not arg2 Then Break
2418  walk_process_tree(me, propagate_has_child_subreaper, NULL)
2419  Break
2420  Case option == PR_GET_CHILD_SUBREAPER
2421  error = Write a simple value into user space(is_child_subreaper, (int__user * )arg2)
2423  Break
2424  Case option == If no_new_privs is set, then operations that grant new privileges (i.e.* execve) will either fail or not grant them. This affects suid/sgid,* file capabilities, and LSMs.* Operations that merely manipulate or drop existing privileges (setresuid,
2425  If arg2 != 1 || arg3 || arg4 || arg5 Then Return -EINVAL
2428  task_set_no_new_privs(current process)
2429  Break
2430  Case option == PR_GET_NO_NEW_PRIVS
2431  If arg2 || arg3 || arg4 || arg5 Then Return -EINVAL
2433  Return If task_no_new_privs(current process) Then 1 Else 0
2434  Case option == PR_GET_THP_DISABLE
2435  If arg2 || arg3 || arg4 || arg5 Then Return -EINVAL
2437  error = Not Not st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from
2438  Break
2439  Case option == PR_SET_THP_DISABLE
2440  If arg3 || arg4 || arg5 Then Return -EINVAL
2442  If down_write_killable( & mmap_sem) Then Return -EINTR
2444  If arg2 Then Atomically set a bit in memory
2446  Else lear_bit - Clears a bit in memory*@nr: Bit to clear*@addr: Address to start counting from* This is a relaxed atomic operation (no implied memory barriers).
2448  lease a write lock
2449  Break
2450  Case option == No longer implemented, but left here to ensure the numbers stay reserved:
2451  Case option == PR_MPX_DISABLE_MANAGEMENT
2453  Return -EINVAL
2454  Case option == PR_SET_FP_MODE
2455  error = SET_FP_MODE(me, arg2)
2456  Break
2457  Case option == PR_GET_FP_MODE
2458  error = GET_FP_MODE(me)
2459  Break
2460  Case option == set task vector length
2461  error = SVE_SET_VL(arg2)
2462  Break
2463  Case option == get task vector length
2464  error = SVE_GET_VL()
2465  Break
2466  Case option == Per task speculation control
2467  If arg3 || arg4 || arg5 Then Return -EINVAL
2469  error = arch_prctl_spec_ctrl_get(me, arg2)
2470  Break
2471  Case option == PR_SET_SPECULATION_CTRL
2472  If arg4 || arg5 Then Return -EINVAL
2474  error = arch_prctl_spec_ctrl_set(me, arg2, arg3)
2475  Break
2476  Case option == Reset arm64 pointer authentication keys
2477  If arg3 || arg4 || arg5 Then Return -EINVAL
2479  error = PAC_RESET_KEYS(me, arg2)
2480  Break
2481  Case option == Tagged user address controls for arm64
2482  If arg3 || arg4 || arg5 Then Return -EINVAL
2484  error = SET_TAGGED_ADDR_CTRL(arg2)
2485  Break
2486  Case option == PR_GET_TAGGED_ADDR_CTRL
2487  If arg2 || arg3 || arg4 || arg5 Then Return -EINVAL
2489  error = GET_TAGGED_ADDR_CTRL()
2490  Break
2491  Default
2492  error = -EINVAL
2493  Break
2495  Return error