Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\ldt.c Create Date:2022-07-28 07:35:41
Last Modify:2022-05-18 16:20:29 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:write_ldt

Proto:static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)

Type:int

Parameter:

TypeParameterName
void __user *ptr
unsigned longbytecount
intoldmode
466  mm = mm
473  error = -EINVAL
474  If bytecount != size of ldt_info Then Go to out
476  error = -EFAULT
477  If copy_from_user( & ldt_info, ptr, size of ldt_info ) Then Go to out
480  error = -EINVAL
481  If entry_number >= Maximum number of LDT entries supported. Then Go to out
483  If contents == 3 Then
484  If oldmode Then Go to out
486  If seg_not_present == 0 Then Go to out
490  If oldmode && Not base_addr && Not limit || This intentionally ignores lm, since 32-bit apps don't have that field. ( & ldt_info) Then
493  memset( & ldt, 0, size of ldt )
494  Else
496  error = -EINVAL
497  Go to out
500  fill_ldt( & ldt, & ldt_info)
501  If oldmode Then avl = 0
505  If down_write_killable( & ldt_usr_sem) Then Return -EINTR
508  old_ldt = ldt
509  old_nr_entries = If old_ldt Then nr_entries Else 0
510  new_nr_entries = max - return maximum of two values of the same or compatible types*@x: first value*@y: second value(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  If Not new_ldt Then Go to out_unlock
517  If old_ldt Then memcpy(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  If error Then
536  If Not WARN_ON_ONCE(old_ldt) Then free_ldt_pgtables(mm)
538  free_ldt_struct(new_ldt)
539  Go to 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  Return error