函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\ldt.c Create Date:2022-07-27 08:35:06
Last Modify:2022-05-18 16:20:29 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:write_ldt

函数原型:static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)

返回类型:int

参数:

类型参数名称
void __user *ptr
unsigned longbytecount
intoldmode
466  mm等于mm
473  error等于负EINVAL
474  如果bytecount不等于ldt_info的长度则转到:out
476  error等于负EFAULT
477  如果copy_from_user( & ldt_info, ptr, ldt_info的长度)则转到:out
480  error等于负EINVAL
481  如果entry_number大于等于Maximum number of LDT entries supported. 则转到:out
483  如果contents恒等于3则
484  如果oldmode则转到:out
486  如果seg_not_present恒等于0则转到:out
490  如果oldmode且非base_addr且非limitThis intentionally ignores lm, since 32-bit apps don't have that field. ( & ldt_info)则
493  memset( & ldt, 0, ldt的长度)
494  否则
496  error等于负EINVAL
497  转到:out
500  fill_ldt( & ldt, & ldt_info)
501  如果oldmodeavl等于0
505  如果down_write_killable( & ldt_usr_sem)则返回:负EINTR
508  old_ldt等于ldt
509  old_nr_entries等于如果old_ldtnr_entries否则0
510  new_nr_entries等于两数取大(entry_number + 1, old_nr_entries)
512  error等于负ENOMEM
513  new_ldt等于The caller must call finalize_ldt_struct on the result. LDT starts zeroed.
514  如果非new_ldt则转到:out_unlock
517  如果old_ldtmemcpy(entries, entries, old_nr_entries * The size of each LDT entry. )
520  entries[entry_number]等于ldt
521  After calling this, the LDT is immutable.
529  error等于map_ldt_struct(mm, new_ldt, old_ldt ? !slot : 0)
530  如果error
536  如果非WARN_ON_ONCE(old_ldt)则free_ldt_pgtables(mm)
538  free_ldt_struct(new_ldt)
539  转到:out_unlock
542  install_ldt(mm, new_ldt)
543  unmap_ldt_struct(mm, old_ldt)
544  free_ldt_struct(old_ldt)
545  error等于0
547  out_unlock :
548  lease a write lock
549  out :
550  返回:error