Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\proc.c Create Date:2022-07-28 18:25:49
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:proc_keys_show

Proto:static int proc_keys_show(struct seq_file *m, void *v)

Type:int

Parameter:

TypeParameterName
struct seq_file *m
void *v
153  _p = v
154  key = rb_entry(_p, structkey, serial_node)
163  struct keyring_search_context ctx = {index_key = index_key, cred = f_cred, cmp = See if the key we're looking at is the target key., Raw match data = key, Type of lookup for this search. = Direct lookup by description. , flags = (Skip state checks | Search child keyrings also ), }
173  key_ref = make_key_ref(key, 0)
178  If access permissions & possessor can view a key's attributes Then
179  _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
180  skey_ref = Search the process keyrings attached to the supplied cred for the first* matching key under RCU conditions (the caller must be holding the RCU read* lock)
181  _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()
182  If Not IS_ERR(skey_ref) Then
184  key_ref = make_key_ref(key, 1)
189  rc = key_task_permission - Check a key can be used*@key_ref: The key to check.*@cred: The credentials to use.*@perm: The permissions to check for.* Check to see whether permission is granted to use a key in the desired way,
190  If rc < 0 Then Return 0
193  now = ktime_get_real_seconds - Get the seconds portion of CLOCK_REALTIME* Returns the wall clock seconds since 1970. This replaces the* get_seconds() interface which is not y2038 safe on 32bit systems.
195  _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
198  expiry = READ_ONCE( time at which key expires (or 0) )
199  If expiry == 0 Then
200  memcpy(xbuf, "perm", 5)
201  Else if now >= expiry Then
202  memcpy(xbuf, "expd", 5)
203  Else
204  timo = expiry - now
206  If timo < 60 Then sprintf(xbuf, "%llus", timo)
208  Else if timo < 60 * 60 Then sprintf(xbuf, "%llum", div_u64 - unsigned 64bit divide with 32bit divisor*@dividend: unsigned 64bit dividend*@divisor: unsigned 32bit divisor* This is the most common 64bit divide and should be used if possible,* as many 32bit archs can optimize this variant better than a full )
210  Else if timo < 60 * 60 * 24 Then sprintf(xbuf, "%lluh", div_u64 - unsigned 64bit divide with 32bit divisor*@dividend: unsigned 64bit dividend*@divisor: unsigned 32bit divisor* This is the most common 64bit divide and should be used if possible,* as many 32bit archs can optimize this variant better than a full )
212  Else if timo < 60 * 60 * 24 * 7 Then sprintf(xbuf, "%llud", div_u64 - unsigned 64bit divide with 32bit divisor*@dividend: unsigned 64bit dividend*@divisor: unsigned 32bit divisor* This is the most common 64bit divide and should be used if possible,* as many 32bit archs can optimize this variant better than a full )
214  Else sprintf(xbuf, "%lluw", div_u64 - unsigned 64bit divide with 32bit divisor*@dividend: unsigned 64bit dividend*@divisor: unsigned 32bit divisor* This is the most common 64bit divide and should be used if possible,* as many 32bit archs can optimize this variant better than a full )
218  state = key_read_state(key)
223  flags = READ_ONCE( status flags (change with bitops) )
224  seq_printf(m, "%08x %c%c%c%c%c%c%c %5d %4s %08x %5d %5d %-9.9s ", key serial number , state != KEY_IS_UNINSTANTIATED ? 'I' : '-', come up with a suitable timeout value (flags, 'R', set if key had been revoked ), come up with a suitable timeout value (flags, 'D', set if key type has been deleted ), come up with a suitable timeout value (flags, 'Q', set if key consumes quota ), come up with a suitable timeout value (flags, 'U', set if key is being constructed in userspace ), state < 0 ? 'N' : '-', come up with a suitable timeout value (flags, 'i', set if key has been invalidated ), _read - get a refcount's value*@r: the refcount* Return: the refcount's value, xbuf, access permissions , m_kuid_munged - Create a uid from a kuid user-namespace pair.*@targ: The user namespace we want a uid in.*@kuid: The kernel internal uid to start with.* Map @kuid into the user-namespace specified by @targ and* return the resulting uid., m_kgid_munged - Create a gid from a kgid user-namespace pair.*@targ: The user namespace we want a gid in.*@kgid: The kernel internal gid to start with.* Map @kgid into the user-namespace specified by @targ and* return the resulting gid., name)
242  If describe Then describe(key, m)
244  seq_putc(m, '\n')
246  _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()
247  Return 0