函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\cgroup.c Create Date:2022-07-27 14:46:39
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__cgroup_bpf_run_filter_sysctl - Run a program on sysctl*@head: sysctl table header*@table: sysctl table*@write: sysctl is being read (= 0) or written (= 1)*@buf: pointer to buffer passed by user space*@pcount: value-result argument: value is size of

函数原型:int __cgroup_bpf_run_filter_sysctl(struct ctl_table_header *head, struct ctl_table *table, int write, void __user *buf, size_t *pcount, loff_t *ppos, void **new_buf, enum bpf_attach_type type)

返回类型:int

参数:

类型参数名称
struct ctl_table_header *head
struct ctl_table *table
intwrite
void __user *buf
size_t *pcount
loff_t *ppos
void **new_buf
enum bpf_attach_typetype
887  struct bpf_sysctl_kern ctx = {head = head, table = table, write = write, ppos = ppos, cur_val = NULL, cur_len = PAGE_SIZE, new_val = NULL, new_len = 0, new_updated = 0, }
901  cur_val等于kmalloc_track_caller(cur_len, GFP_KERNEL)
902  如果cur_val
904  pos等于0
906  old_fs等于获取当前进程地址空间上限()
907  设置寄存器值(fs)
908  如果 Callback for text formatting (table, 0, (void__user * )cur_val, & cur_len, & pos)则
911  cur_len等于0
913  设置寄存器值(fs)
914  否则
916  cur_len等于0
919  如果writebufpcount
923  new_val等于kmalloc_track_caller(PAGE_SIZE, GFP_KERNEL)
924  new_len等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(size_t, PAGE_SIZE, * pcount)
925  如果非new_valcopy_from_user(new_val, buf, new_len)则new_len等于0
931  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
932  cgrp等于task_dfl_cgroup(当前进程)
933  ret等于BPF_PROG_RUN_ARRAY( array of effective progs in this cgroup [type], & ctx, BPF_PROG_RUN)
934  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
936  kfree(cur_val)
938  如果ret恒等于1且new_updated
939  new_buf等于new_val
940  pcount等于new_len
941  否则
942  kfree(new_val)
945  返回:如果ret恒等于1则0否则负EPERM