Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:ma_parse_add_rule - add a rule to ima_policy_rules*@rule - ima measurement policy rule* Avoid locking by allowing just one writer at a time in ima_write_policy()* Returns the length of the rule parsed, an error code on failure

Proto:ssize_t ima_parse_add_rule(char *rule)

Type:ssize_t

Parameter:

TypeParameterName
char *rule
1259  op[] = "update_policy"
1263  audit_info = 0
1265  p = strsep - Split a string into tokens*@s: The string to be searched*@ct: The characters to search for* strsep() updates @s to point after the token, ready for the next call.* It returns empty tokens, too, behaving exactly like the libc function
1266  len = strlen - Find the length of a string*@s: The string to be sized + 1
1267  p += strspn - Calculate the length of the initial substring of @s which only contain letters in @accept*@s: The string to be searched*@accept: The string to search for
1269  If p == '#' || p == '\0' Then Return len
1272  entry = 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).
1273  If Not entry Then
1274  integrity_audit_msg(Integrity enable status , NULL, NULL, op, "-ENOMEM", - ENOMEM, audit_info)
1276  Return -ENOMEM
1279  Initialization list head
1281  result = ima_parse_rule(p, entry)
1282  If result Then
1283  kfree(entry)
1284  integrity_audit_msg(Integrity enable status , NULL, NULL, op, "invalid-policy", result, audit_info)
1287  Return result
1290  list_add_tail - add a new entry*@new: new entry to be added*@head: list head to add it before* Insert a new entry before the specified head.* This is useful for implementing queues.
1292  Return len
Caller
NameDescribe
ima_write_policy
ima_read_policy