函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:moyo_print_bprm - Print "struct linux_binprm" for auditing

函数原型:static char *tomoyo_print_bprm(struct linux_binprm *bprm, struct tomoyo_page_dump *dump)

返回类型:char

参数:

类型参数名称
struct linux_binprm *bprm
struct tomoyo_page_dump *dump
25  tomoyo_buffer_len等于4096乘2
26  buffer等于分配内存并置零
30  pos等于current top of mem
31  offset等于pos取模PAGE_SIZE
32  argv_count等于argc
33  envp_count等于envc
34  bool truncated = false
36  如果非buffer则返回:NULL
38  len等于snprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@
39  cp等于bufferlen
40  如果非argv_count
41  memmove(cp, "} envp[]={ ", 11)
42  cp加等于11
44  last_start等于cp
45 argv_countenvp_count循环
46  如果非tomoyo_dump_page(bprm, pos, dump)则转到:out
48  pos加等于PAGE_SIZEoffset
50 offset小于PAGE_SIZE循环
52  c等于kaddr[offset++]
54  如果cp恒等于last_startcp自加等于'"'
56  如果cp大于等于buffertomoyo_buffer_len减32则
58  truncated = true
59  否则如果c恒等于'\\'则
60  cp自加等于'\\'
61  cp自加等于'\\'
62  否则如果c大于' '且c小于127则
63  cp自加等于c
64  否则如果非c
65  cp自加等于'"'
66  cp自加等于' '
67  last_start等于cp
68  否则
69  cp自加等于'\\'
70  cp自加等于c右移6位的值加'0'
71  cp自加等于c右移3位按位与7的值加'0'
72  cp自加等于c按位与7的值加'0'
74  如果c则继续下一循环
76  如果argv_count
77  如果argv_count先自减恒等于0则
78  如果truncated
79  cp等于last_start
80  memmove(cp, "... ", 4)
81  cp加等于4
83  memmove(cp, "} envp[]={ ", 11)
84  cp加等于11
85  last_start等于cp
86  truncated = false
88  否则如果envp_count
89  如果envp_count先自减恒等于0则
90  如果truncated
91  cp等于last_start
92  memmove(cp, "... ", 4)
93  cp加等于4
97  如果非argv_count且非envp_count退出
100  offset等于0
102  cp自加等于'}'
103  cp等于'\0'
104  返回:buffer
105  out :
106  snprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@
108  返回:buffer
调用者
名称描述
tomoyo_init_logmoyo_init_log - Allocate buffer for audit logs