Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:ipc\shm.c Create Date:2022-07-28 16:47:51
Last Modify:2020-03-17 22:58:32 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:shmctl_do_lock

Proto:static int shmctl_do_lock(struct ipc_namespace *ns, int shmid, int cmd)

Type:int

Parameter:

TypeParameterName
struct ipc_namespace *ns
intshmid
intcmd
1070  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
1071  shp = shm_obtain_object_check(ns, shmid)
1072  If IS_ERR(shp) Then
1073  err = PTR_ERR(shp)
1074  Go to out_unlock1
1077  audit_ipc_obj( & (shm_perm))
1078  err = security_shm_shmctl( & shm_perm, cmd)
1079  If err Then Go to out_unlock1
1082  ipc_lock_object( & shm_perm)
1085  If Not pc_valid_object() - helper to sort out IPC_RMID races for codepaths* where the respective ipc_ids.rwsem is not being held down.* Checks whether the ipc object is still around or if it's gone already, as Then
1086  err = -EIDRM
1087  Go to out_unlock0
1090  If Not ns_capable(user_ns, Allow mlock and mlockall(which doesn't really have anything to do with IPC)) Then
1091  euid = current_euid()
1093  If Not uid_eq(euid, uid) && Not uid_eq(euid, cuid) Then
1095  err = -EPERM
1096  Go to out_unlock0
1099  err = -EPERM
1100  Go to out_unlock0
1104  shm_file = shm_file
1105  If is_file_hugepages(shm_file) Then Go to out_unlock0
1108  If cmd == super user shmctl commands Then
1109  user = current_user()
1111  err = shmem_lock(shm_file, 1, user)
1112  If Not err && Not (mode & segment will not be swapped ) Then
1114  mlock_user = user
1116  Go to out_unlock0
1120  If Not (mode & segment will not be swapped ) Then Go to out_unlock0
1122  shmem_lock(shm_file, 0, mlock_user)
1123  mode &= ~segment will not be swapped
1124  mlock_user = NULL
1125  get_file(shm_file)
1126  ipc_unlock_object( & shm_perm)
1127  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1128  shmem_unlock_mapping(f_mapping)
1130  fput(shm_file)
1131  Return err
1133  out_unlock0 :
1134  ipc_unlock_object( & shm_perm)
1135  out_unlock1 :
1136  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1137  Return err
Caller
NameDescribe
ksys_shmctl
compat_ksys_shmctl