函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:This registers a new binary format, it recognises the syntax* ':name:type:offset:magic:mask:interpreter:flags'* where the ':' is the IFS, that can be chosen with the first char

函数原型:static Node *create_entry(const char __user *buffer, size_t count)

返回类型:Node

参数:

类型参数名称
const char __user *buffer
size_tcount
328  pr_debug("register: received %zu bytes\n", count)
331  err等于负EINVAL
332  如果count小于11或count大于Max length of the register string则转到:out
335  err等于负ENOMEM
336  memsize等于sizeof(Node)加count加8
337  e等于开辟内存
338  如果非e则转到:out
341  p等于buf等于esizeof(Node)
343  memset(e, 0, sizeof(Node))
344  如果copy_from_user(buf, buffer, count)则转到:efault
347  del等于p自加
349  pr_debug("register: delim: %#x {%c}\n", del, del)
352  memset(buf + count, del, 8)
355  name等于p
356  p等于strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
357  如果非p则转到:einval
359  p自加等于'\0'
360  如果非name[0]或非字符串比较或非字符串比较strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for则转到:einval
366  pr_debug("register: name: {%s}\n", name)
370  :++ == 'E'
371  pr_debug("register: type: E (extension)\n")
372  type, status, etc. 等于1左移Enabled
373  退出
374  :++ == 'M'
375  pr_debug("register: type: M (magic)\n")
376  type, status, etc. 等于1左移Enabled位按位或1左移Magic
377  退出
378  默认
379  转到:einval
381  如果p自加不等于del则转到:einval
384  如果st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from
389  s等于strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
390  如果非s则转到:einval
392  s等于'\0'
393  如果p不等于s
395  如果r不等于0或 offset of magic 小于0则转到:einval
398  p等于s
399  如果p自加则转到:einval
401  pr_debug("register: offset: %#x\n", offset of magic )
404  magic or filename extension 等于p
405  p等于parses and copies one argument enclosed in del from *sp to *dp,* recognising the \x special.* returns pointer to the copied argument or NULL in case of an* error (and sets err) or null argument length.
406  如果非p则转到:einval
408  如果非 magic or filename extension [0]则转到:einval
410  如果USE_DEBUGprint_hex_dump_bytes - shorthand form of print_hex_dump() with default params*@prefix_str: string to prefix each line with;* caller supplies trailing spaces for alignment if desired*@prefix_type: controls whether prefix of an offset, address, or none* is (KBUILD_MODNAME": register: magic[raw]: ", DUMP_PREFIX_NONE, magic or filename extension , p - magic or filename extension )
416  mask, NULL for exact match 等于p
417  p等于parses and copies one argument enclosed in del from *sp to *dp,* recognising the \x special.* returns pointer to the copied argument or NULL in case of an* error (and sets err) or null argument length.
418  如果非p则转到:einval
420  如果非 mask, NULL for exact match [0]则
422  pr_debug("register: mask[raw]: none\n")
423  否则如果USE_DEBUGprint_hex_dump_bytes - shorthand form of print_hex_dump() with default params*@prefix_str: string to prefix each line with;* caller supplies trailing spaces for alignment if desired*@prefix_type: controls whether prefix of an offset, address, or none* is (KBUILD_MODNAME": register: mask[raw]: ", DUMP_PREFIX_NONE, mask, NULL for exact match , p - mask, NULL for exact match )
434  size of magic/mask 等于string_unescape_inplace( magic or filename extension , UNESCAPE_HEX)
435  如果 mask, NULL for exact match string_unescape_inplace( mask, NULL for exact match , UNESCAPE_HEX)不等于 size of magic/mask 则转到:einval
438  如果 size of magic/mask 大于sizeof(linux_binprm->buf) sizeof(linux_binprm->buf) size of magic/mask 小于 offset of magic 则转到:einval
441  pr_debug("register: magic/mask length: %i\n", size of magic/mask )
442  如果USE_DEBUG
466  否则
470  p等于strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
471  如果非p则转到:einval
473  p自加等于'\0'
476  magic or filename extension 等于p
477  p等于strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
478  如果非p则转到:einval
480  p自加等于'\0'
481  如果非 magic or filename extension [0]或strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for则转到:einval
483  pr_debug("register: extension: {%s}\n", magic or filename extension )
486  p等于strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
487  如果非p则转到:einval
489  p自加等于'\0'
493  filename of interpreter 等于p
494  p等于strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
495  如果非p则转到:einval
497  p自加等于'\0'
498  如果非 filename of interpreter [0]则转到:einval
500  pr_debug("register: interpreter: {%s}\n", filename of interpreter )
503  p等于check_special_flags(p, e)
504  如果p恒等于'\n'则p自加
506  如果p不等于bufcount则转到:einval
509  返回:e
511  out :
512  返回:错误号
514  efault :
515  释放内存
516  返回:错误号
517  einval :
518  释放内存
519  返回:错误号
调用者
名称描述
bm_register_write/register