Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__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

Proto: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)

Type:int

Parameter:

TypeParameterName
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  If cur_val Then
904  pos = 0
906  old_fs = get_fs()
907  set_fs(KERNEL_DS)
908  If Callback for text formatting (table, 0, (void__user * )cur_val, & cur_len, & pos) Then
911  cur_len = 0
913  set_fs(old_fs)
914  Else
916  cur_len = 0
919  If write && buf && pcount Then
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  If Not new_val || copy_from_user(new_val, buf, new_len) Then 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(current process)
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  If ret == 1 && new_updated Then
939  new_buf = new_val
940  pcount = new_len
941  Else
942  kfree(new_val)
945  Return If ret == 1 Then 0 Else -EPERM