Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\tomoyo\audit.c Create Date:2022-07-28 19:33:14
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:moyo_init_log - Allocate buffer for audit logs

Proto:char *tomoyo_init_log(struct tomoyo_request_info *r, int len, const char *fmt, va_list args)

Type:char

Parameter:

TypeParameterName
struct tomoyo_request_info *r
intlen
const char *fmt
va_listargs
247  char * buf = NULL
248  char * bprm_info = NULL
249  const char * header = NULL
250  char * realpath = NULL
251  const char * symlink = NULL
253  domainname = name
255  header = moyo_print_header - Get header line of audit log.*@r: Pointer to "struct tomoyo_request_info".* Returns string representation.* This function uses kmalloc(), so caller must kfree() if this function* didn't return NULL.
256  If Not header Then Return NULL
259  len += strlen - Find the length of a string*@s: The string to be sized + strlen - Find the length of a string*@s: The string to be sized + 10
260  If For holding parameters specific to execve() request.* NULL if not dealing do_execve(). Then
261  file = file
263  realpath = tomoyo_realpath_from_path( & f_path)
264  bprm_info = moyo_print_bprm - Print "struct linux_binprm" for auditing
265  If Not realpath || Not bprm_info Then Go to out
268  len += strlen - Find the length of a string*@s: The string to be sized + 80 + strlen - Find the length of a string*@s: The string to be sized
269  Else if For holding parameters specific to operations which deal files.* NULL if not dealing files. && * Content of symbolic link to be created. NULL for operations other * than symlink(). Then
270  symlink = name
272  len += 18 + strlen - Find the length of a string*@s: The string to be sized
274  len = moyo_round2 - Round up to power of 2 for calculating memory usage.*@size: Size to be rounded up.* Returns @size.* Since SLOB does not round up, this function simply returns @size.
275  buf = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
276  If Not buf Then Go to out
278  len--
279  pos = 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*@
280  If realpath Then
281  bprm = bprm
283  pos += 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*@
286  Else if symlink Then pos += 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*@
289  pos += 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*@
290  vsnprintf - 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*@args: Arguments for the format string* This function generally
291  out :
292  kfree(realpath)
293  kfree(bprm_info)
294  kfree(header)
295  Return buf
Caller
NameDescribe
tomoyo_write_log2moyo_write_log2 - Write an audit log.*@r: Pointer to "struct tomoyo_request_info".*@len: Buffer size needed for @fmt and @args.*@fmt: The printf()'s format string.*@args: va_list structure for @fmt.* Returns nothing.
tomoyo_supervisormoyo_supervisor - Ask for the supervisor's decision