linux/ipc/util.c
<<
/opt2.6/spalue 2.6/formue 2.6a /opt2. href="../linux+v3 9/ipc/util.c">/opt2.6img src="../.static/gfx/right.png" alt=">>">/o6/spalue/o6spal class="lxr_search">/opt/opt2.6input typ hidden" nam navtarget" > ">/opt2.6input typ text" nam search" id search">/opt2.6butt3" typ submit">Search/opt2.Prefse 2.6/a>/o6/spaluept2. .6/divuept2. .6form ac val="ajax+*" method="post" onsubmit="return false;">/o6input typ hidden" nam ajax_lookup" id ajax_lookup" > ">/pt2. .6/formue/pt2. .6div class="headingbott3m">e 6div id file_contents"u
. .16/a>6spal class="comment">/*6/spalue. .26/a>6spal class="comment"> * linux/ipc/util.c6/spalue. .36/a>6spal class="comment"> * Copyright (C) 1992 Krishna Balasubramanian6/spalue. .46/a>6spal class="comment"> *6/spalue. .56/a>6spal class="comment"> * Sep 1997 - Call suser() last after "normal" permiss.3"
checks so we6/spalue. .66/a>6spal class="comment"> *            get BSD style process accounting right.6/spalue. .76/a>6spal class="comment"> *            Occurs in several places in the IPC code.6/spalue. .86/a>6spal class="comment"> *            Chris Evans, <chris@ferret.lmh.ox.ac.uk>6/spalue. .96/a>6spal class="comment"> * Nov 1999 - ipc helper func vals, unified SMP locking6/spalue. on va>6spal class="comment"> *            Manfred Spraul <manfred@colorfullife.com>6/spalue. 116/a>6spal class="comment"> * Oct 2002 - One lock per IPC id. RCU ipc_free for lock-free grow_ary().6/spalue. 126/a>6spal class="comment"> *            Mingming Cao <cmm@us.ibm.com>6/spalue. 136/a>6spal class="comment"> * Mar 2006 - support for audit of ipc object properties6/spalue. 146/a>6spal class="comment"> *            Dustin Kirkland <dustin.kirkland@us.ibm.com>6/spalue. 156/a>6spal class="comment"> * Jun 2006 - nam
spaces ssupport6/spalue. 166/a>6spal class="comment"> *            OpenVZ, SWsoft Inc.6/spalue. 176/a>6spal class="comment"> *            Pavel Emelianov <xemul@openvz.org>6/spalue. 186/a>6spal class="comment"> */6/spalue. 196/a>e. 2n va>#include <linux/mm.h va>>e. 21 va>#include <linux/shm.h va>>e. 22 va>#include <linux/init.h va>>e. 23 va>#include <linux/msg.h va>>e. 24 va>#include <linux/vmalloc.h va>>e. 25 va>#include <linux/slab.h va>>e. 26 va>#include <linux/capability.h va>>e. 27 va>#include <linux/highuid.h va>>e. 28 va>#include <linux/security.h va>>e. 29 va>#include <linux/rcupdate.h va>>e. 3n va>#include <linux/workqueue.h va>>e. 31 va>#include <linux/seq_file.h va>>e. 32 va>#include <linux/proc_fs.h va>>e. 33 va>#include <linux/audit.h va>>e. 34 va>#include <linux/nsproxy.h va>>e. 35 va>#include <linux/rwsem.h va>>e. 36 va>#include <linux/memory.h va>>e. 37 va>#include <linux/ipc_nam
space.h va>>e. 386/a>e. 39 va>#include <asm/unistd.h va>>e. 406/a>e. 41 va>#include "util.h va>"e. 426/a>e. 43 va>struct.6a href="+code=ipc_proc_iface" class="sref">ipc_proc_iface va> {e. 44 va>        const char *6a href="+code=path" class="sref">path va>;e. 45 va>        const char *6a href="+code=header" class="sref">header va>;e. 46 va>        int.6a href="+code=ids" class="sref">ids va>;e. 47 va>        int.(*6a href="+code=show" class="sref">show va>)(struct.6a href="+code=seq_file" class="sref">seq_file va> *, void *);e. 486/a>};e. 496/a>e. 5n va>#ifdef.6a href="+code=CONFIG_MEMORY_HOTPLUG" class="sref">CONFIG_MEMORY_HOTPLUG6/a>e. 516/a>e. 52 va>static void 6a href="+code=ipc_memory_notifier" class="sref">ipc_memory_notifier va>(struct.6a href="+code=work_struct" class="sref">work_struct va> *6a href="+code=work" class="sref">work va>)e. 53 va>{e. 54 va>        6a href="+code=ipcns_notify" class="sref">ipcns_notify va>(6a href="+code=IPCNS_MEMCHANGED" class="sref">IPCNS_MEMCHANGED va>);e. 55 va>}e. 566/a>e. 57 va>static 6a href="+code=DECLARE_WORK" class="sref">DECLARE_WORK va>(6a href="+code=ipc_memory_wq" class="sref">ipc_memory_wq va>, 6a href="+code=ipc_memory_notifier" class="sref">ipc_memory_notifier va>);e. 586/a>e. 596/a>e. 60 va>static int.6a href="+code=ipc_memory_callback" class="sref">ipc_memory_callback va>(struct.6a href="+code=notifier_block" class="sref">notifier_block va> *6a href="+code=self" class="sref">self va>,e. 61 va>                                unsigned long.6a href="+code=ac val" class="sref">ac val va>, void *6a href="+code=arg" class="sref">arg va>)e. 62 va>{e. 63 va>        switch (6a href="+code=ac val" class="sref">ac val va>) {e. 64 va>        case.6a href="+code=MEM_ONLINE" class="sref">MEM_ONLINE va>:    6spal class="comment">/* memory successfully brought online */6/spalue. 65 va>        case.6a href="+code=MEM_OFFLINE" class="sref">MEM_OFFLINE va>:   6spal class="comment">/* or offline: it's time to recompute msgmni */6/spalue. 66 va>                6spal class="comment">/*6/spalue. 676/a>6spal class="comment">                 * This is done by invoking the ipcns notifier chain with the6/spalue. 686/a>6spal class="comment">                 * IPC_MEMCHANGED event.6/spalue. 696/a>6spal class="comment">                 * In order not to keep the lock on the hotplug memory chain6/spalue. 7n va>6spal class="comment">                 * for too long, queue a work item that will, when waken up,6/spalue. 716/a>6spal class="comment">                 * ac vvate the ipcns notificat.3"
chain.6/spalue. 726/a>6spal class="comment">                 * No need to keep several ipc work items on the queue.6/spalue. 736/a>6spal class="comment">                 */6/spalue. 74 va>                if (!6a href="+code=work_pending" class="sref">work_pending va>(&6a href="+code=ipc_memory_wq" class="sref">ipc_memory_wq va>))e. 75 va>                        6a href="+code=schedule_work" class="sref">schedule_work va>(&6a href="+code=ipc_memory_wq" class="sref">ipc_memory_wq va>);e. 76 va>                break;e. 77 va>        case.6a href="+code=MEM_GOING_ONLINE" class="sref">MEM_GOING_ONLINE va>:e. 78 va>        case.6a href="+code=MEM_GOING_OFFLINE" class="sref">MEM_GOING_OFFLINE va>:e. 79 va>        case.6a href="+code=MEM_CANCEL_ONLINE" class="sref">MEM_CANCEL_ONLINE va>:e. 80 va>        case.6a href="+code=MEM_CANCEL_OFFLINE" class="sref">MEM_CANCEL_OFFLINE va>:e. 81 va>        default:e. 82 va>                break;e. 83 va>        }e. 846/a>e. 85 va>        return 6a href="+code=NOTIFY_OK" class="sref">NOTIFY_OK va>;e. 86 va>}e. 876/a>e. 88 va>#endif 6spal class="comment">/* CONFIG_MEMORY_HOTPLUG */6/spalue. 896/a>e. 9n va>6spal class="comment">/**6/spalue. 916/a>6spal class="comment"> *      ipc_init        -       initialise IPC subsystem6/spalue. 926/a>6spal class="comment"> *6/spalue. 936/a>6spal class="comment"> *      The various system5 IPC resources (semaphores, messages and shared6/spalue. 946/a>6spal class="comment"> *      memory) are initialised6/spalue. 956/a>6spal class="comment"> *      A callback routine is registered into the memory hotplug notifier vspalue. 966/a>6spal class="comment"> *      chain: since msgmni scales to lowmem this callback routine will be6/spalue. 976/a>6spal class="comment"> *      called upon successful memory add / remove to recompute msmgni.6/spalue. 986/a>6spal class="comment"> */6/spalue. 99 va> e.100 va>static int.6a href="+code=__init" class="sref">__init va> 6a href="+code=ipc_init" class="sref">ipc_init va>(void)e.101 va>{e.102 va>        6a href="+code=sem_init" class="sref">sem_init va>();e.103 va>        6a href="+code=msg_init" class="sref">msg_init va>();e.104 va>        6a href="+code=shm_init" class="sref">shm_init va>();e.105 va>        6a href="+code=hotplug_memory_notifier" class="sref">hotplug_memory_notifier va>(6a href="+code=ipc_memory_callback" class="sref">ipc_memory_callback va>, 6a href="+code=IPC_CALLBACK_PRI" class="sref">IPC_CALLBACK_PRI va>);e.106 va>        6a href="+code=register_ipcns_notifier" class="sref">register_ipcns_notifier va>(&6a href="+code=init_ipc_ns" class="sref">init_ipc_ns va>);e.107 va>        return 0;e.108 va>}e.1096/a>6a href="+code=__initcall" class="sref">__initcall va>(6a href="+code=ipc_init" class="sref">ipc_init va>);e.1106/a>e.1116/a>6spal class="comment">/**6/spalue.1126/a>6spal class="comment"> *      ipc_init_ids            -       initialise IPC identifiers6/spalue.1136/a>6spal class="comment"> *      @ids: Identifier set6/spalue.1146/a>6spal class="comment"> *6/spalue.1156/a>6spal class="comment"> *      Set up the sequence range to use for the ipc identifier range (limited6/spalue.1166/a>6spal class="comment"> *      below IPCMNI) then initialise the ids idr.6/spalue.1176/a>6spal class="comment"> */6/spalue.1186/a> e.1196/a>void 6a href="+code=ipc_init_ids" class="sref">ipc_init_ids va>(struct.6a href="+code=ipc_ids" class="sref">ipc_ids va> *6a href="+code=ids" class="sref">ids va>)e.12n va>{e.121 va>        6a href="+code=init_rwsem" class="sref">init_rwsem va>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=rw_mutex" class="sref">rw_mutex va>);e.1226/a>e.123 va>        6a href="+code=ids" class="sref">ids va>->6a href="+code=in_use" class="sref">in_use va> = 0;e.124 va>        6a href="+code=ids" class="sref">ids va>->6a href="+code=seq" class="sref">seq va> = 0;e.125 va>        {e.126 va>                int.6a href="+code=seq_limit" class="sref">seq_limit va> = 6a href="+code=INT_MAX" class="sref">INT_MAX va>/6a href="+code=SEQ_MULTIPLIER" class="sref">SEQ_MULTIPLIER va>;e.127 va>                if (6a href="+code=seq_limit" class="sref">seq_limit va> > 6a href="+code=USHRT_MAX" class="sref">USHRT_MAX va>)e.128 va>                        6a href="+code=ids" class="sref">ids va>->6a href="+code=seq_max" class="sref">seq_max va> = 6a href="+code=USHRT_MAX" class="sref">USHRT_MAX va>;e.129 va>                 elsee.130 va>                        6a href="+code=ids" class="sref">ids va>->6a href="+code=seq_max" class="sref">seq_max va> = 6a href="+code=seq_limit" class="sref">seq_limit va>;e.131 va>        }e.1326/a>e.133 va>        6a href="+code=idr_init" class="sref">idr_init va>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=ipcs_idr" class="sref">ipcs_idr va>);e.134 va>}e.135 va>e.136 va>#ifdef.6a href="+code=CONFIG_PROC_FS" class="sref">CONFIG_PROC_FS va>e.137 va>static const struct.6a href="+code=file_operat.3"s" class="sref">file_operat.3"s va> 6a href="+code=sysvipc_proc_fops" class="sref">sysvipc_proc_fops va>;e.1386/a>6spal class="comment">/**6/spalue.1396/a>6spal class="comment"> *      ipc_init_proc_interface -  Create a proc interface for sysipc typ
s using a seq_file interface.6/spalue.14n va>6spal class="comment"> *      @path: Path in procfs6/spalue.1416/a>6spal class="comment"> *      @header: Banner to be printed at the beginning of the file.6/spalue.1426/a>6spal class="comment"> *      @ids: ipc id table to iterate.6/spalue.1436/a>6spal class="comment"> *      @show: show routine.6/spalue.1446/a>6spal class="comment"> */6/spalue.145 va>void 6a href="+code=__init" class="sref">__init va> 6a href="+code=ipc_init_proc_interface" class="sref">ipc_init_proc_interface va>(const char *6a href="+code=path" class="sref">path va>, const char *6a href="+code=header" class="sref">header va>,e.146 va>                int.6a href="+code=ids" class="sref">ids va>, int.(*6a href="+code=show" class="sref">show va>)(struct.6a href="+code=seq_file" class="sref">seq_file va> *, void *))e.147 va>{e.148 va>        struct.6a href="+code=proc_dir_entry" class="sref">proc_dir_entry va> *6a href="+code=pde" class="sref">pde va>;e.149 va>        struct.6a href="+code=ipc_proc_iface" class="sref">ipc_proc_iface va> *6a href="+code=iface" class="sref">iface va>;e.1506/a>e.151 va>        6a href="+code=iface" class="sref">iface va> = 6a href="+code=kmalloc" class="sref">kmalloc va>(sizeof(*6a href="+code=iface" class="sref">iface va>), 6a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL va>);e.152 va>        if (!6a href="+code=iface" class="sref">iface va>)e.153 va>                return;e.154 va>        6a href="+code=iface" class="sref">iface va>->6a href="+code=path" class="sref">path va>     = 6a href="+code=path" class="sref">path va>;e.155 va>        6a href="+code=iface" class="sref">iface va>->6a href="+code=header" class="sref">header va>   = 6a href="+code=header" class="sref">header va>;e.156 va>        6a href="+code=iface" class="sref">iface va>->6a href="+code=ids" class="sref">ids va>      = 6a href="+code=ids" class="sref">ids va>;e.157 va>        6a href="+code=iface" class="sref">iface va>->6a href="+code=show" class="sref">show va>     = 6a href="+code=show" class="sref">show va>;e.1586/a>e.159 va>        6a href="+code=pde" class="sref">pde va> = 6a href="+code=proc_create_data" class="sref">proc_create_data va>(6a href="+code=path" class="sref">path va>,e.160 va>                               6a href="+code=S_IRUGO" class="sref">S_IRUGO va>,        6spal class="comment">/* world readable */6/spalue.161 va>                               6a href="+code=NULL" class="sref">NULL va>,           6spal class="comment">/* parent dir */6/spalue.162 va>                               &6a href="+code=sysvipc_proc_fops" class="sref">sysvipc_proc_fops va>,e.163 va>                               6a href="+code=iface" class="sref">iface va>);e.164 va>        if (!6a href="+code=pde" class="sref">pde va>) {e.165 va>                6a href="+code=kfree" class="sref">kfree va>(6a href="+code=iface" class="sref">iface va>);e.166 va>        }e.1676/a>}e.168 va>#endife.1696/a>e.17n va>6spal class="comment">/**6/spalue.1716/a>6spal class="comment"> *      ipc_findkey     -       find a key in al ipc identifier set     6/spalue.1726/a>6spal class="comment"> *      @ids: Identifier set6/spalue.1736/a>6spal class="comment"> *      @key: The key to find6/spalue.1746/a>6spal class="comment"> *      6/spalue.1756/a>6spal class="comment"> *      Requires ipc_ids.rw_mutex locked.6/spalue.1766/a>6spal class="comment"> *      Returns the LOCKED pointer to the ipc structure if found or NULL vspalue.1776/a>6spal class="comment"> *      if not.6/spalue.1786/a>6spal class="comment"> *      If key is found ipc points to the owning ipc structure6/spalue.1796/a>6spal class="comment"> */6/spalue.180 va> e.181 va>static struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6a href="+code=ipc_findkey" class="sref">ipc_findkey va>(struct.6a href="+code=ipc_ids" class="sref">ipc_ids va> *6a href="+code=ids" class="sref">ids va>, 6a href="+code=key_t" class="sref">key_t va> 6a href="+code=key" class="sref">key va>)e.182 va>{e.183 va>        struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6a href="+code=ipc" class="sref">ipc va>;e.184 va>        int.6a href="+code=next_id" class="sref">next_id va>;e.185 va>        int.6a href="+code=total" class="sref">total va>;e.1866/a>e.187 va>        for (6a href="+code=total" class="sref">total va> = 0, 6a href="+code=next_id" class="sref">next_id va> = 0;.6a href="+code=total" class="sref">total va> < 6a href="+code=ids" class="sref">ids va>->6a href="+code=in_use" class="sref">in_use va>; 6a href="+code=next_id" class="sref">next_id va>++) {e.188 va>                6a href="+code=ipc" class="sref">ipc va> = 6a href="+code=idr_find" class="sref">idr_find6/a>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=ipcs_idr" class="sref">ipcs_idr va>, 6a href="+code=next_id" class="sref">next_id va>);e.1896/a>e.190 va>                if (6a href="+code=ipc" class="sref">ipc va> == 6a href="+code=NULL" class="sref">NULL va>)e.191 va>                        continue;e.1926/a>e.193 va>                if (6a href="+code=ipc" class="sref">ipc va>->6a href="+code=key" class="sref">key va> != 6a href="+code=key" class="sref">key va>) {e.194 va>                        6a href="+code=total" class="sref">total va>++;e.195 va>                        continue;e.196 va>                }e.1976/a>e.198 va>                6a href="+code=ipc_lock_by_ptr" class="sref">ipc_lock_by_ptr va>(6a href="+code=ipc" class="sref">ipc va>);e.199 va>                return 6a href="+code=ipc" class="sref">ipc va>;e.200 va>        }e.2016/a>e.202 va>        return 6a href="+code=NULL" class="sref">NULL va>;e.203 va>}e.2046/a>e.2056/a>6spal class="comment">/**6/spalue.2066/a>6spal class="comment"> *      ipc_get_maxid   -       get the last assigned id6/spalue.2076/a>6spal class="comment"> *      @ids: IPC identifier set6/spalue.2086/a>6spal class="comment"> *6/spalue.2096/a>6spal class="comment"> *      Called with ipc_ids.rw_mutex held.6/spalue.2on va>6spal class="comment"> */6/spalue.2116/a>e.2126/a>int.6a href="+code=ipc_get_maxid" class="sref">ipc_get_maxid va>(struct.6a href="+code=ipc_ids" class="sref">ipc_ids va> *6a href="+code=ids" class="sref">ids va>)e.213 va>{e.214 va>        struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6a href="+code=ipc" class="sref">ipc va>;e.215 va>        int.6a href="+code=max_id" class="sref">max_id va> = -1;e.216 va>        int.6a href="+code=total" class="sref">total va>, 6a href="+code=id" class="sref">id va>;e.2176/a>e.218 va>        if (6a href="+code=ids" class="sref">ids va>->6a href="+code=in_use" class="sref">in_use va> == 0)e.219 va>                return -1;e.2206/a>e.221 va>        if (6a href="+code=ids" class="sref">ids va>->6a href="+code=in_use" class="sref">in_use va> == 6a href="+code=IPCMNI" class="sref">IPCMNI va>)e.222 va>                return 6a href="+code=IPCMNI" class="sref">IPCMNI va> - 1;e.223 va>e.224 va>        6spal class="comment">/* Look for the last assigned id */6/spalue.225 va>        6a href="+code=total" class="sref">total va> = 0;e.226 va>        for (6a href="+code=id" class="sref">id va> = 0;.6a href="+code=id" class="sref">id va> < 6a href="+code=IPCMNI" class="sref">IPCMNI va> &&.6a href="+code=total" class="sref">total va> < 6a href="+code=ids" class="sref">ids va>->6a href="+code=in_use" class="sref">in_use va>; 6a href="+code=id" class="sref">id va>++) {e.227 va>                6a href="+code=ipc" class="sref">ipc va> = 6a href="+code=idr_find" class="sref">idr_find6/a>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=ipcs_idr" class="sref">ipcs_idr va>, 6a href="+code=id" class="sref">id va>);e.228 va>                if (6a href="+code=ipc" class="sref">ipc va> != 6a href="+code=NULL" class="sref">NULL va>) {e.229 va>                        6a href="+code=max_id" class="sref">max_id va> = 6a href="+code=id" class="sref">id va>;e.230 va>                        6a href="+code=total" class="sref">total va>++;e.231 va>                }e.232 va>        }e.233 va>        return 6a href="+code=max_id" class="sref">max_id va>;e.234 va>}e.235 va>e.2366/a>6spal class="comment">/**6/spalue.2376/a>6spal class="comment"> *      ipc_addid       -       add al IPC identifier6/spalue.2386/a>6spal class="comment"> *      @ids: IPC identifier set6/spalue.2396/a>6spal class="comment"> *      @new: new IPC permission set6/spalue.24n va>6spal class="comment"> *      @size: limit for the number of used ids6/spalue.2416/a>6spal class="comment"> *6/spalue.2426/a>6spal class="comment"> *      Add al entry 'new' to the IPC ids idr. The permissions object is6/spalue.2436/a>6spal class="comment"> *      initialised and the first free entry is set up and the id assigned6/spalue.2446/a>6spal class="comment"> *      is returned. The 'new' entry is returned in a locked state on success.6/spalue.2456/a>6spal class="comment"> *      On failure the entry is not locked and a negative err-code is returned.6/spalue.2466/a>6spal class="comment"> *6/spalue.2476/a>6spal class="comment"> *      Called with ipc_ids.rw_mutex held as a writer.6/spalue.2486/a>6spal class="comment"> */6/spalue.249 va> e.2506/a>int.6a href="+code=ipc_addid" class="sref">ipc_addid va>(struct.6a href="+code=ipc_ids" class="sref">ipc_ids va>*.6a href="+code=ids" class="sref">ids va>, struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va>*.6a href="+code=new" class="sref">new va>, int.6a href="+code=size" class="sref">size va>)e.251 va>{e.252 va>        6a href="+code=uid_t" class="sref">uid_t va> 6a href="+code=euid" class="sref">euid va>;e.253 va>        6a href="+code=gid_t" class="sref">gid_t va> 6a href="+code=egid" class="sref">egid va>;e.254 va>        int.6a href="+code=id" class="sref">id va>, 6a href="+code=err" class="sref">err va>;e.255 va>e.256 va>        if (6a href="+code=size" class="sref">size va> > 6a href="+code=IPCMNI" class="sref">IPCMNI va>)e.257 va>                6a href="+code=size" class="sref">size va> = 6a href="+code=IPCMNI" class="sref">IPCMNI va>;e.2586/a>e.259 va>        if (6a href="+code=ids" class="sref">ids va>->6a href="+code=in_use" class="sref">in_use va> >= 6a href="+code=size" class="sref">size va>)e.260 va>                return -6a href="+code=ENOSPC" class="sref">ENOSPC va>;e.2616/a>e.262 va>        6a href="+code=spin_lock_init" class="sref">spin_lock_init6/a>(&6a href="+code=new" class="sref">new va>->6a href="+code=lock" class="sref">lock va>);e.263 va>        6a href="+code=new" class="sref">new va>->6a href="+code=deleted" class="sref">deleted va> = 0;e.264 va>        6a href="+code=rcu_read_lock" class="sref">rcu_read_lock6/a>();e.265 va>        6a href="+code=spin_lock" class="sref">spin_lock6/a>(&6a href="+code=new" class="sref">new va>->6a href="+code=lock" class="sref">lock va>);e.2666/a>e.267 va>        6a href="+code=err" class="sref">err va> = 6a href="+code=idr_get_new" class="sref">idr_get_new6/a>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=ipcs_idr" class="sref">ipcs_idr va>, 6a href="+code=new" class="sref">new va>, &6a href="+code=id" class="sref">id va>);e.268 va>        if (6a href="+code=err" class="sref">err va>) {e.269 va>                6a href="+code=spin_unlock" class="sref">spin_unlock6/a>(&6a href="+code=new" class="sref">new va>->6a href="+code=lock" class="sref">lock va>);e.270 va>                6a href="+code=rcu_read_unlock" class="sref">rcu_read_unlock6/a>();e.271 va>                return 6a href="+code=err" class="sref">err va>;e.272 va>        }e.273 va>e.274 va>        6a href="+code=ids" class="sref">ids va>->6a href="+code=in_use" class="sref">in_use va>++;e.275 va>e.276 va>        6a href="+code=current_euid_egid" class="sref">current_euid_egid6/a>(&6a href="+code=euid" class="sref">euid va>, &6a href="+code=egid" class="sref">egid va>);e.277 va>        6a href="+code=new" class="sref">new va>->6a href="+code=cuid" class="sref">cuid va> = 6a href="+code=new" class="sref">new va>->6a href="+code=uid" class="sref">uid va> = 6a href="+code=euid" class="sref">euid va>;e.278 va>        6a href="+code=new" class="sref">new va>->6a href="+code=gid" class="sref">gid va> = 6a href="+code=new" class="sref">new va>->6a href="+code=cgid" class="sref">cgid va> = 6a href="+code=egid" class="sref">egid va>;e.2796/a>e.280 va>        6a href="+code=new" class="sref">new va>->6a href="+code=seq" class="sref">seq va> = 6a href="+code=ids" class="sref">ids va>->6a href="+code=seq" class="sref">seq va>++;e.281 va>        if(6a href="+code=ids" class="sref">ids va>->6a href="+code=seq" class="sref">seq va> > 6a href="+code=ids" class="sref">ids va>->6a href="+code=seq_max" class="sref">seq_max va>)e.282 va>                6a href="+code=ids" class="sref">ids va>->6a href="+code=seq" class="sref">seq va> = 0;e.283 va>e.284 va>        6a href="+code=new" class="sref">new va>->6a href="+code=id" class="sref">id va> = 6a href="+code=ipc_buildid" class="sref">ipc_buildid6/a>(6a href="+code=id" class="sref">id va>, 6a href="+code=new" class="sref">new va>->6a href="+code=seq" class="sref">seq va>);e.285 va>        return 6a href="+code=id" class="sref">id va>;e.286 va>}e.2876/a>e.2886/a>6spal class="comment">/**6/spalue.2896/a>6spal class="comment"> *      ipcget_new      -       create a new ipc object6/spalue.29n va>6spal class="comment"> *      @ns: nam
space6/spalue.2916/a>6spal class="comment"> *      @ids: IPC identifer set6/spalue.2926/a>6spal class="comment"> *      @ops: the actual creation routine to call vspalue.2936/a>6spal class="comment"> *      @params: its parameters6/spalue.2946/a>6spal class="comment"> *6/spalue.2956/a>6spal class="comment"> *      This routine is called by sys_msgget, sys_semget() and sys_shmget()6/spalue.2966/a>6spal class="comment"> *      when the key is IPC_PRIVATE.6/spalue.2976/a>6spal class="comment"> */6/spalue.298 va>static int.6a href="+code=ipcget_new" class="sref">ipcget_new6/a>(struct.6a href="+code=ipc_nam
space" class="sref">ipc_nam
space6/a> *6a href="+code="s" class="sref">ns va>, struct.6a href="+code=ipc_ids" class="sref">ipc_ids va> *6a href="+code=ids" class="sref">ids va>,e.299 va>                struct.6a href="+code=ipc_ops" class="sref">ipc_ops va> *6a href="+code=ops" class="sref">ops va>, struct.6a href="+code=ipc_params" class="sref">ipc_params va> *6a href="+code=params" class="sref">params va>)e.30n va>{e.301 va>        int.6a href="+code=err" class="sref">err va>;e.302 va>6a href="+code=retry" class="sref">retry va>:e.303 va>        6a href="+code=err" class="sref">err va> = 6a href="+code=idr_pre_get" class="sref">idr_pre_get6/a>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=ipcs_idr" class="sref">ipcs_idr va>, 6a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL va>);e.3046/a>e.305 va>        if (!6a href="+code=err" class="sref">err va>)e.306 va>                return -6a href="+code=ENOMEM" class="sref">ENOMEM va>;e.3076/a>e.308 va>        6a href="+code=down_write" class="sref">down_write6/a>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=rw_mutex" class="sref">rw_mutex va>);e.309 va>        6a href="+code=err" class="sref">err va> = 6a href="+code=ops" class="sref">ops va>->6a href="+code=getnew" class="sref">getnew6/a>(6a href="+code="s" class="sref">ns va>, 6a href="+code=params" class="sref">params va>);e.310 va>        6a href="+code=up_write" class="sref">up_write6/a>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=rw_mutex" class="sref">rw_mutex va>);e.3116/a>e.312 va>        if (6a href="+code=err" class="sref">err va> == -6a href="+code=EAGAIN" class="sref">EAGAIN va>)e.313 va>                goto 6a href="+code=retry" class="sref">retry va>;e.3146/a>e.315 va>        return 6a href="+code=err" class="sref">err va>;e.316 va>}e.3176/a>e.3186/a>6spal class="comment">/**6/spalue.3196/a>6spal class="comment"> *      ipc_check_perms -       check security and permissions for al IPC6/spalue.32n va>6spal class="comment"> *      @ns: IPC nam
space6/spalue.3216/a>6spal class="comment"> *      @ipcp: ipc permission set6/spalue.3226/a>6spal class="comment"> *      @ops: the actual security routine to call vspalue.3236/a>6spal class="comment"> *      @params: its parameters6/spalue.3246/a>6spal class="comment"> *6/spalue.3256/a>6spal class="comment"> *      This routine is called by sys_msgget(), sys_semget() and sys_shmget()6/spalue.3266/a>6spal class="comment"> *      when the key is not IPC_PRIVATE and that key already exists in the6/spalue.3276/a>6spal class="comment"> *      ids IDR.6/spalue.3286/a>6spal class="comment"> *6/spalue.3296/a>6spal class="comment"> *      On success, the IPC id is returned.6/spalue.33n va>6spal class="comment"> *6/spalue.3316/a>6spal class="comment"> *      It is called with ipc_ids.rw_mutex and ipcp->lock held.6/spalue.3326/a>6spal class="comment"> */6/spalue.333 va>static int.6a href="+code=ipc_check_perms" class="sref">ipc_check_perms6/a>(struct.6a href="+code=ipc_nam
space" class="sref">ipc_nam
space6/a> *6a href="+code="s" class="sref">ns va>,e.334 va>                           struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6a href="+code=ipcp" class="sref">ipcp va>,e.335 va>                           struct.6a href="+code=ipc_ops" class="sref">ipc_ops va> *6a href="+code=ops" class="sref">ops va>,e.336 va>                           struct.6a href="+code=ipc_params" class="sref">ipc_params va> *6a href="+code=params" class="sref">params va>)e.337 va>{e.338 va>        int.6a href="+code=err" class="sref">err va>;e.3396/a>e.340 va>        if (6a href="+code=ipcperms" class="sref">ipcperms6/a>(6a href="+code="s" class="sref">ns va>, 6a href="+code=ipcp" class="sref">ipcp va>, 6a href="+code=params" class="sref">params va>->6a href="+code=flg" class="sref">flg va>))e.341 va>                6a href="+code=err" class="sref">err va> = -6a href="+code=EACCES" class="sref">EACCES va>;e.342 va>        else {e.343 va>                6a href="+code=err" class="sref">err va> = 6a href="+code=ops" class="sref">ops va>->6a href="+code=associate" class="sref">associate6/a>(6a href="+code=ipcp" class="sref">ipcp va>, 6a href="+code=params" class="sref">params va>->6a href="+code=flg" class="sref">flg va>);e.344 va>                if (!6a href="+code=err" class="sref">err va>)e.345 va>                        6a href="+code=err" class="sref">err va> = 6a href="+code=ipcp" class="sref">ipcp va>->6a href="+code=id" class="sref">id va>;e.346 va>        }e.3476/a>e.348 va>        return 6a href="+code=err" class="sref">err va>;e.349 va>}e.3506/a>e.3516/a>6spal class="comment">/**6/spalue.3526/a>6spal class="comment"> *      ipcget_public   -       get al ipc object or create a new one6/spalue.3536/a>6spal class="comment"> *      @ns: nam
space6/spalue.3546/a>6spal class="comment"> *      @ids: IPC identifer set6/spalue.3556/a>6spal class="comment"> *      @ops: the actual creation routine to call vspalue.3566/a>6spal class="comment"> *      @params: its parameters6/spalue.3576/a>6spal class="comment"> *6/spalue.3586/a>6spal class="comment"> *      This routine is called by sys_msgget, sys_semget() and sys_shmget()6/spalue.3596/a>6spal class="comment"> *      when the key is not IPC_PRIVATE.6/spalue.36n va>6spal class="comment"> *      It adds a new entry if the key is not found and does some permission6/spalue.3616/a>6spal class="comment"> *      / security checkings if the key is found.6/spalue.3626/a>6spal class="comment"> *6/spalue.3636/a>6spal class="comment"> *      On success, the ipc id is returned.6/spalue.3646/a>6spal class="comment"> */6/spalue.365 va>static int.6a href="+code=ipcget_public" class="sref">ipcget_public6/a>(struct.6a href="+code=ipc_nam
space" class="sref">ipc_nam
space6/a> *6a href="+code="s" class="sref">ns va>, struct.6a href="+code=ipc_ids" class="sref">ipc_ids va> *6a href="+code=ids" class="sref">ids va>,e.366 va>                struct.6a href="+code=ipc_ops" class="sref">ipc_ops va> *6a href="+code=ops" class="sref">ops va>, struct.6a href="+code=ipc_params" class="sref">ipc_params va> *6a href="+code=params" class="sref">params va>)e.367 va>{e.368 va>        struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6a href="+code=ipcp" class="sref">ipcp va>;e.369 va>        int.6a href="+code=flg" class="sref">flg va> = 6a href="+code=params" class="sref">params va>->6a href="+code=flg" class="sref">flg va>;e.370 va>        int.6a href="+code=err" class="sref">err va>;e.3716/a>6a href="+code=retry" class="sref">retry va>:e.372 va>        6a href="+code=err" class="sref">err va> = 6a href="+code=idr_pre_get" class="sref">idr_pre_get6/a>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=ipcs_idr" class="sref">ipcs_idr va>, 6a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL va>);e.373 va>e.374 va>        6spal class="comment">/*6/spalue.3756/a>6spal class="comment">         * Take the lock as a writer since we are potentially going to add6/spalue.3766/a>6spal class="comment">         * a new entry + read locks are not "upgradable"6/spalue.3776/a>6spal class="comment">         */6/spalue.378 va>        6a href="+code=down_write" class="sref">down_write6/a>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=rw_mutex" class="sref">rw_mutex va>);e.379 va>        6a href="+code=ipcp" class="sref">ipcp va> = 6a href="+code=ipc_findkey" class="sref">ipc_findkey va>(6a href="+code=ids" class="sref">ids va>, 6a href="+code=params" class="sref">params va>->6a href="+code=key" class="sref">key va>);e.380 va>        if (6a href="+code=ipcp" class="sref">ipcp va> == 6a href="+code=NULL" class="sref">NULL va>) {e.381 va>                6spal class="comment">/* key not used */6/spalue.382 va>                if (!(6a href="+code=flg" class="sref">flg va> &.6a href="+code=IPC_CREAT" class="sref">IPC_CREAT va>))e.383 va>                        6a href="+code=err" class="sref">err va> = -6a href="+code=ENOENT" class="sref">ENOENT va>;e.384 va>                else if (!6a href="+code=err" class="sref">err va>)e.385 va>                        6a href="+code=err" class="sref">err va> = -6a href="+code=ENOMEM" class="sref">ENOMEM va>;e.386 va>                elsee.387 va>                        6a href="+code=err" class="sref">err va> = 6a href="+code=ops" class="sref">ops va>->6a href="+code=getnew" class="sref">getnew6/a>(6a href="+code="s" class="sref">ns va>, 6a href="+code=params" class="sref">params va>);e.388 va>        } else {e.389 va>                6spal class="comment">/* ipc object has been locked by ipc_findkey() */6/spalue.3906/a>e.391 va>                if (6a href="+code=flg" class="sref">flg va> &.6a href="+code=IPC_CREAT" class="sref">IPC_CREAT va> &&.6a href="+code=flg" class="sref">flg va> &.6a href="+code=IPC_EXCL" class="sref">IPC_EXCL va>)e.392 va>                        6a href="+code=err" class="sref">err va> = -6a href="+code=EEXIST" class="sref">EEXIST va>;e.393 va>                else {e.394 va>                        6a href="+code=err" class="sref">err va> = 0;e.395 va>                        if (6a href="+code=ops" class="sref">ops va>->6a href="+code=more_checks" class="sref">more_checks va>)e.396 va>                                6a href="+code=err" class="sref">err va> = 6a href="+code=ops" class="sref">ops va>->6a href="+code=more_checks" class="sref">more_checks va>(6a href="+code=ipcp" class="sref">ipcp va>, 6a href="+code=params" class="sref">params va>);e.397 va>                        if (!6a href="+code=err" class="sref">err va>)e.398 va>                                6spal class="comment">/*6/spalue.3996/a>6spal class="comment">                                 * ipc_check_perms returns the IPC id on6/spalue.40n va>6spal class="comment">                                 * success6/spalue.4016/a>6spal class="comment">                                 */6/spalue.402 va>                                6a href="+code=err" class="sref">err va> = 6a href="+code=ipc_check_perms" class="sref">ipc_check_perms6/a>(6a href="+code="s" class="sref">ns va>, 6a href="+code=ipcp" class="sref">ipcp va>, 6a href="+code=ops" class="sref">ops va>, 6a href="+code=params" class="sref">params va>);e.403 va>                }e.404 va>                6a href="+code=ipc_unlock" class="sref">ipc_unlock va>(6a href="+code=ipcp" class="sref">ipcp va>);e.405 va>        }e.406 va>        6a href="+code=up_write" class="sref">up_write6/a>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=rw_mutex" class="sref">rw_mutex va>);e.4076/a>e.408 va>        if (6a href="+code=err" class="sref">err va> == -6a href="+code=EAGAIN" class="sref">EAGAIN va>)e.409 va>                goto 6a href="+code=retry" class="sref">retry va>;e.4106/a>e.411 va>        return 6a href="+code=err" class="sref">err va>;e.412 va>}e.413 va>e.4146/a>e.4156/a>6spal class="comment">/**6/spalue.4166/a>6spal class="comment"> *      ipc_rmid        -       remove al IPC identifier6/spalue.4176/a>6spal class="comment"> *      @ids: IPC identifier set6/spalue.4186/a>6spal class="comment"> *      @ipcp: ipc perm structure containing the identifier to remove6/spalue.4196/a>6spal class="comment"> *6/spalue.42n va>6spal class="comment"> *      ipc_ids.rw_mutex (as a writer) and the spinlock for this ID are held6/spalue.4216/a>6spal class="comment"> *      before this function is called, and remain locked on the exit.6/spalue.4226/a>6spal class="comment"> */6/spalue.4236/a> e.4246/a>void 6a href="+code=ipc_rmid" class="sref">ipc_rmid6/a>(struct.6a href="+code=ipc_ids" class="sref">ipc_ids va> *6a href="+code=ids" class="sref">ids va>, struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6a href="+code=ipcp" class="sref">ipcp va>)e.4256/a>{e.426 va>        int.6a href="+code=lid" class="sref">lid va> = 6a href="+code=ipcid_to_idx" class="sref">ipcid_to_idx va>(6a href="+code=ipcp" class="sref">ipcp va>->6a href="+code=id" class="sref">id va>);e.4276/a>e.428 va>        6a href="+code=idr_remove" class="sref">idr_remove6/a>(&6a href="+code=ids" class="sref">ids va>->6a href="+code=ipcs_idr" class="sref">ipcs_idr va>, 6a href="+code=lid" class="sref">lid va>);e.4296/a>e.430 va>        6a href="+code=ids" class="sref">ids va>->6a href="+code=in_use" class="sref">in_use va>--;e.4316/a>e.432 va>        6a href="+code=ipcp" class="sref">ipcp va>->6a href="+code=deleted" class="sref">deleted va> = 1;e.433 va>e.434 va>        return;e.435 va>}e.4366/a>e.4376/a>6spal class="comment">/**6/spalue.4386/a>6spal class="comment"> *      ipc_alloc       -       allocate ipc space6/spalue.4396/a>6spal class="comment"> *      @size: size desired6/spalue.44n va>6spal class="comment"> *6/spalue.4416/a>6spal class="comment"> *      Allocate memory from the appropriate pools and return a pointer to it.6/spalue.4426/a>6spal class="comment"> *      NULL is returned if the allocation fails6/spalue.4436/a>6spal class="comment"> */6/spalue.444 va> e.445 va>void*.6a href="+code=ipc_alloc" class="sref">ipc_alloc6/a>(int.6a href="+code=size" class="sref">size va>)e.446 va>{e.447 va>        void*.6a href="+code=out" class="sref">out va>;e.448 va>        if(6a href="+code=size" class="sref">size va> > 6a href="+code=PAGE_SIZE" class="sref">PAGE_SIZE va>)e.449 va>                6a href="+code=out" class="sref">out va> = 6a href="+code=vmalloc" class="sref">vmalloc va>(6a href="+code=size" class="sref">size va>);e.450 va>        elsee.451 va>                6a href="+code=out" class="sref">out va> = 6a href="+code=kmalloc" class="sref">kmalloc va>(6a href="+code=size" class="sref">size va>, 6a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL va>);e.452 va>        return 6a href="+code=out" class="sref">out va>;e.4536/a>}e.4546/a>e.4556/a>6spal class="comment">/**6/spalue.4566/a>6spal class="comment"> *      ipc_free        -       free ipc space6/spalue.4576/a>6spal class="comment"> *      @ptr: pointer returned by ipc_alloc vspalue.4586/a>6spal class="comment"> *      @size: size of block vspalue.4596/a>6spal class="comment"> * vspalue.46n va>6spal class="comment"> *      Free a block created with ipc_alloc(). The caller must know the size vspalue.4616/a>6spal class="comment"> *      used in the allocation call.6/spalue.4626/a>6spal class="comment"> */6/spalue.463 va>e.4646/a>void 6a href="+code=ipc_free" class="sref">ipc_free va>(void*.6a href="+code=ptr" class="sref">ptr va>, int.6a href="+code=size" class="sref">size va>)e.4656/a>{e.466 va>        if(6a href="+code=size" class="sref">size va> > 6a href="+code=PAGE_SIZE" class="sref">PAGE_SIZE va>)e.467 va>                6a href="+code=vfree" class="sref">vfree va>(6a href="+code=ptr" class="sref">ptr va>);e.468 va>        elsee.469 va>                6a href="+code=kfree" class="sref">kfree va>(6a href="+code=ptr" class="sref">ptr va>);e.470 va>}e.4716/a>e.4726/a>6spal class="comment">/*6/spalue.4736/a>6spal class="comment"> * rcu allocations:6/spalue.4746/a>6spal class="comment"> * There are three headers that are prepended to the actual allocation:6/spalue.4756/a>6spal class="comment"> * - during use: ipc_rcu_hdr.6/spalue.4766/a>6spal class="comment"> * - during the rcu grace period: ipc_rcu_grace.6/spalue.4776/a>6spal class="comment"> * - [only if vmalloc]: ipc_rcu_sched.6/spalue.4786/a>6spal class="comment"> * Their lifetime doesn't overlap, thus the headers share the sam
 memory.6/spalue.4796/a>6spal class="comment"> * Unlike a normal union, they are right-aligned, thus some container_of6/spalue.48n va>6spal class="comment"> * forward/backward casting is necessary:6/spalue.4816/a>6spal class="comment"> */6/spalue.482 va>struct.6a href="+code=ipc_rcu_hdr" class="sref">ipc_rcu_hdr6/a>e.483 va>{e.484 va>        int.6a href="+code=refcount" class="sref">refcount va>;e.485 va>        int.6a href="+code=is_vmalloc" class="sref">is_vmalloc va>;e.486 va>        void *6a href="+code=data" class="sref">data va>[0];e.487 va>};e.488 va>e.4896/a>e.4906/a>struct.6a href="+code=ipc_rcu_grace" class="sref">ipc_rcu_grace6/a>e.491 va>{e.492 va>        struct.6a href="+code=rcu_head" class="sref">rcu_head va> 6a href="+code=rcu" class="sref">rcu va>;e.493 va>        6spal class="comment">/* "void *" makes sure alignment of following data is sane. */6/spalue.494 va>        void *6a href="+code=data" class="sref">data va>[0];e.495 va>};e.4966/a>e.497 va>struct.6a href="+code=ipc_rcu_sched" class="sref">ipc_rcu_sched6/a>e.498 va>{e.499 va>        struct.6a href="+code=work_struct" class="sref">work_struct va> 6a href="+code=work" class="sref">work va>;e.500 va>        6spal class="comment">/* "void *" makes sure alignment of following data is sane. */6/spalue.501 va>        void *6a href="+code=data" class="sref">data va>[0];e.502 va>};e.503 va>e.504 va>#define 6a href="+code=HDRLEN_KMALLOC" class="sref">HDRLEN_KMALLOC va>          (sizeof(struct.6a href="+code=ipc_rcu_grace" class="sref">ipc_rcu_grace6/a>) > sizeof(struct.6a href="+code=ipc_rcu_hdr" class="sref">ipc_rcu_hdr6/a>) ? \e.505 va>                                        sizeof(struct.6a href="+code=ipc_rcu_grace" class="sref">ipc_rcu_grace6/a>) : sizeof(struct.6a href="+code=ipc_rcu_hdr" class="sref">ipc_rcu_hdr6/a>))e.506 va>#define 6a href="+code=HDRLEN_VMALLOC" class="sref">HDRLEN_VMALLOC va>          (sizeof(struct.6a href="+code=ipc_rcu_sched" class="sref">ipc_rcu_sched6/a>) > 6a href="+code=HDRLEN_KMALLOC" class="sref">HDRLEN_KMALLOC va> ? \e.507 va>                                        sizeof(struct.6a href="+code=ipc_rcu_sched" class="sref">ipc_rcu_sched6/a>) : 6a href="+code=HDRLEN_KMALLOC" class="sref">HDRLEN_KMALLOC va>)e.508 va>e.509 va>static 6a href="+code=inline" class="sref">inline va> int.6a href="+code=rcu_use_vmalloc" class="sref">rcu_use_vmalloc6/a>(int.6a href="+code=size" class="sref">size va>)e.51n va>{e.511 va>        6spal class="comment">/* Too big for a single page? */6/spalue.512 va>        if (6a href="+code=HDRLEN_KMALLOC" class="sref">HDRLEN_KMALLOC va> +.6a href="+code=size" class="sref">size va> > 6a href="+code=PAGE_SIZE" class="sref">PAGE_SIZE va>)e.513 va>                return 1;e.514 va>        return 0;e.515 va>}e.5166/a>e.5176/a>6spal class="comment">/**6/spalue.5186/a>6spal class="comment"> *      ipc_rcu_alloc   -       allocate ipc and rcu space 6/spalue.5196/a>6spal class="comment"> *      @size: size desired6/spalue.52n va>6spal class="comment"> *6/spalue.5216/a>6spal class="comment"> *      Allocate memory for the rcu header structure +  the object.6/spalue.5226/a>6spal class="comment"> *      Returns the pointer to the object.6/spalue.5236/a>6spal class="comment"> *      NULL is returned if the allocation fails. 6/spalue.5246/a>6spal class="comment"> */6/spalue.5256/a> e.526 va>void*.6a href="+code=ipc_rcu_alloc" class="sref">ipc_rcu_alloc6/a>(int.6a href="+code=size" class="sref">size va>)e.527 va>{e.528 va>        void*.6a href="+code=out" class="sref">out va>;e.529 va>        6spal class="comment">/* 6/spalue.53n va>6spal class="comment">         * We prepend the allocation with the rcu struct, and6/spalue.5316/a>6spal class="comment">         * workqueue if necessary (for vmalloc). 6/spalue.5326/a>6spal class="comment">         */6/spalue.533 va>        if (6a href="+code=rcu_use_vmalloc" class="sref">rcu_use_vmalloc6/a>(6a href="+code=size" class="sref">size va>)) {e.534 va>                6a href="+code=out" class="sref">out va> = 6a href="+code=vmalloc" class="sref">vmalloc va>(6a href="+code=HDRLEN_VMALLOC" class="sref">HDRLEN_VMALLOC va> +.6a href="+code=size" class="sref">size va>);e.535 va>                if (6a href="+code=out" class="sref">out va>) {e.536 va>                        6a href="+code=out" class="sref">out va> += 6a href="+code=HDRLEN_VMALLOC" class="sref">HDRLEN_VMALLOC va>;e.537 va>                        6a href="+code=container_of" class="sref">container_of6/a>(6a href="+code=out" class="sref">out va>, struct.6a href="+code=ipc_rcu_hdr" class="sref">ipc_rcu_hdr6/a>, 6a href="+code=data" class="sref">data va>)->6a href="+code=is_vmalloc" class="sref">is_vmalloc va> = 1;e.538 va>                        6a href="+code=container_of" class="sref">container_of6/a>(6a href="+code=out" class="sref">out va>, struct.6a href="+code=ipc_rcu_hdr" class="sref">ipc_rcu_hdr6/a>, 6a href="+code=data" class="sref">data va>)->6a href="+code=refcount" class="sref">refcount va> = 1;e.539 va>                }e.540 va>        } else {e.541 va>                6a href="+code=out" class="sref">out va> = 6a href="+code=kmalloc" class="sref">kmalloc va>(6a href="+code=HDRLEN_KMALLOC" class="sref">HDRLEN_KMALLOC va> +.6a href="+code=size" class="sref">size va>, 6a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL va>);e.542 va>                if (6a href="+code=out" class="sref">out va>) {e.543 va>                        6a href="+code=out" class="sref">out va> += 6a href="+code=HDRLEN_KMALLOC" class="sref">HDRLEN_KMALLOC va>;e.544 va>                        6a href="+code=container_of" class="sref">container_of6/a>(6a href="+code=out" class="sref">out va>, struct.6a href="+code=ipc_rcu_hdr" class="sref">ipc_rcu_hdr6/a>, 6a href="+code=data" class="sref">data va>)->6a href="+code=is_vmalloc" class="sref">is_vmalloc va> = 0;e.545 va>                        6a href="+code=container_of" class="sref">container_of6/a>(6a href="+code=out" class="sref">out va>, struct.6a href="+code=ipc_rcu_hdr" class="sref">ipc_rcu_hdr6/a>, 6a href="+code=data" class="sref">data va>)->6a href="+code=refcount" class="sref">refcount va> = 1;e.546 va>                }e.547 va>        }e.548 va>e.549 va>        return 6a href="+code=out" class="sref">out va>;e.550 va>}e.5516/a>e.552 va>void 6a href="+code=ipc_rcu_getref" class="sref">ipc_rcu_getref6/a>(void *6a href="+code=ptr" class="sref">ptr va>)e.553 va>{e.554 va>        6a href="+code=container_of" class="sref">container_of6/a>(6a href="+code=ptr" class="sref">ptr va>, struct.6a href="+code=ipc_rcu_hdr" class="sref">ipc_rcu_hdr6/a>, 6a href="+code=data" class="sref">data va>)->6a href="+code=refcount" class="sref">refcount va>++;e.555 va>}e.5566/a>e.557 va>static void 6a href="+code=ipc_do_vfree" class="sref">ipc_do_vfree6/a>(struct.6a href="+code=work_struct" class="sref">work_struct va> *6a href="+code=work" class="sref">work va>)e.558 va>{e.559 va>        6a href="+code=vfree" class="sref">vfree va>(6a href="+code=container_of" class="sref">container_of6/a>(6a href="+code=work" class="sref">work va>, struct.6a href="+code=ipc_rcu_sched" class="sref">ipc_rcu_sched6/a>, 6a href="+code=work" class="sref">work va>));e.560 va>}e.5616/a>e.5626/a>6spal class="comment">/**6/spalue.5636/a>6spal class="comment"> * ipc_schedule_free - free ipc + rcu space6/spalue.5646/a>6spal class="comment"> * @head: RCU callback structure for queued work vspalue.5656/a>6spal class="comment"> *  vspalue.5666/a>6spal class="comment"> * Since RCU callback function is called in bh, vspalue.5676/a>6spal class="comment"> * we need to defer the vfree to schedule_work().6/spalue.5686/a>6spal class="comment"> */6/spalue.569 va>static void 6a href="+code=ipc_schedule_free" class="sref">ipc_schedule_free6/a>(struct.6a href="+code=rcu_head" class="sref">rcu_head va> *6a href="+code=head" class="sref">head va>)e.57n va>{e.571 va>        struct.6a href="+code=ipc_rcu_grace" class="sref">ipc_rcu_grace6/a> *6a href="+code=grace" class="sref">grace6/a>;e.572 va>        struct.6a href="+code=ipc_rcu_sched" class="sref">ipc_rcu_sched6/a> *6a href="+code=sched" class="sref">sched6/a>;e.573 va>e.574 va>        6a href="+code=grace" class="sref">grace6/a> = 6a href="+code=container_of" class="sref">container_of6/a>(6a href="+code=head" class="sref">head va>, struct.6a href="+code=ipc_rcu_grace" class="sref">ipc_rcu_grace6/a>, 6a href="+code=rcu" class="sref">rcu va>);e.575 va>        6a href="+code=sched" class="sref">sched6/a> = 6a href="+code=container_of" class="sref">container_of6/a>(&(6a href="+code=grace" class="sref">grace6/a>->6a href="+code=data" class="sref">data va>[0]), struct.6a href="+code=ipc_rcu_sched" class="sref">ipc_rcu_sched6/a>,e.576 va>                                6a href="+code=data" class="sref">data va>[0]);e.5776/a>e.578 va>        6a href="+code=INIT_WORK" class="sref">INIT_WORK6/a>(&6a href="+code=sched" class="sref">sched6/a>->6a href="+code=work" class="sref">work va>, 6a href="+code=ipc_do_vfree" class="sref">ipc_do_vfree6/a>);e.579 va>        6a href="+code=schedule_work" class="sref">schedule_work6/a>(&6a href="+code=sched" class="sref">sched6/a>->6a href="+code=work" class="sref">work va>);e.580 va>}e.5816/a>e.582 va>void 6a href="+code=ipc_rcu_putref" class="sref">ipc_rcu_putref6/a>(void *6a href="+code=ptr" class="sref">ptr va>)e.583 va>{e.584 va>        if (--6a href="+code=container_of" class="sref">container_of6/a>(6a href="+code=ptr" class="sref">ptr va>, struct.6a href="+code=ipc_rcu_hdr" class="sref">ipc_rcu_hdr6/a>, 6a href="+code=data" class="sref">data va>)->6a href="+code=refcount" class="sref">refcount va> > 0)e.585 va>                return;e.5866/a>e.587 va>        if (6a href="+code=container_of" class="sref">container_of6/a>(6a href="+code=ptr" class="sref">ptr va>, struct.6a href="+code=ipc_rcu_hdr" class="sref">ipc_rcu_hdr6/a>, 6a href="+code=data" class="sref">data va>)->6a href="+code=is_vmalloc" class="sref">is_vmalloc va>) {e.588 va>                6a href="+code=call_rcu" class="sref">call_rcu6/a>(&6a href="+code=container_of" class="sref">container_of6/a>(6a href="+code=ptr" class="sref">ptr va>, struct.6a href="+code=ipc_rcu_grace" class="sref">ipc_rcu_grace6/a>, 6a href="+code=data" class="sref">data va>)->6a href="+code=rcu" class="sref">rcu va>,e.589 va>                                6a href="+code=ipc_schedule_free" class="sref">ipc_schedule_free6/a>);e.590 va>        } else {e.591 va>                6a href="+code=kfree_rcu" class="sref">kfree_rcu va>(6a href="+code=container_of" class="sref">container_of6/a>(6a href="+code=ptr" class="sref">ptr va>, struct.6a href="+code=ipc_rcu_grace" class="sref">ipc_rcu_grace6/a>, 6a href="+code=data" class="sref">data va>), 6a href="+code=rcu" class="sref">rcu va>);e.592 va>        }e.5936/a>}e.5946/a>e.5956/a>6spal class="comment">/**6/spalue.5966/a>6spal class="comment"> *      ipcperms        -       check IPC permissions6/spalue.5976/a>6spal class="comment"> *      @ns: IPC nam
space6/spalue.5986/a>6spal class="comment"> *      @ipcp: IPC permission set6/spalue.5996/a>6spal class="comment"> *      @flag: desired permission set.6/spalue.60n va>6spal class="comment"> *6/spalue.6016/a>6spal class="comment"> *      Check user, group, other permissions for access6/spalue.6026/a>6spal class="comment"> *      to ipc resources. return 0 if allowed6/spalue.6036/a>6spal class="comment"> *6/spalue.6046/a>6spal class="comment"> *      @flag will most probably be 0 or S_...UGO from <linux/stat.h>6/spalue.6056/a>6spal class="comment"> */6/spalue.606 va> e.607 va>int.6a href="+code=ipcperms" class="sref">ipcperms6/a>(struct.6a href="+code=ipc_nam
space" class="sref">ipc_nam
space6/a> *6a href="+code="s" class="sref">ns va>, struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6a href="+code=ipcp" class="sref">ipcp va>, short.6a href="+code=flag" class="sref">flag va>)e.608 va>{e.609 va>        6a href="+code=uid_t" class="sref">uid_t va> 6a href="+code=euid" class="sref">euid6/a> = 6a href="+code=current_euid" class="sref">current_euid6/a>();e.610 va>        int.6a href="+code=requested_mode" class="sref">requested_mode6/a>, 6a href="+code=granted_mode" class="sref">granted_mode6/a>;e.6116/a>e.612 va>        6a href="+code=audit_ipc_obj" class="sref">audit_ipc_obj6/a>(6a href="+code=ipcp" class="sref">ipcp va>);e.613 va>        6a href="+code=requested_mode" class="sref">requested_mode6/a> = (6a href="+code=flag" class="sref">flag va> >> 6) | (6a href="+code=flag" class="sref">flag va> >> 3) | 6a href="+code=flag" class="sref">flag va>;e.614 va>        6a href="+code=granted_mode" class="sref">granted_mode6/a> = 6a href="+code=ipcp" class="sref">ipcp va>->6a href="+code=mode" class="sref">mode6/a>;e.615 va>        if (6a href="+code=euid" class="sref">euid6/a> == 6a href="+code=ipcp" class="sref">ipcp va>->6a href="+code=cuid" class="sref">cuid6/a> ||e.616 va>            6a href="+code=euid" class="sref">euid6/a> == 6a href="+code=ipcp" class="sref">ipcp va>->6a href="+code=uid" class="sref">uid6/a>)e.617 va>                6a href="+code=granted_mode" class="sref">granted_mode6/a> >>= 6;e.618 va>        else if (6a href="+code=in_group_p" class="sref">in_group_p6/a>(6a href="+code=ipcp" class="sref">ipcp va>->6a href="+code=cgid" class="sref">cgid6/a>) || 6a href="+code=in_group_p" class="sref">in_group_p6/a>(6a href="+code=ipcp" class="sref">ipcp va>->6a href="+code=gid" class="sref">gid6/a>))e.619 va>                6a href="+code=granted_mode" class="sref">granted_mode6/a> >>= 3;e.620 va>        6spal class="comment">/* is there some bit set in requested_mode but not in granted_mode? */6/spalue.621 va>        if ((6a href="+code=requested_mode" class="sref">requested_mode6/a> & ~6a href="+code=granted_mode" class="sref">granted_mode6/a> & 0007) && e.622 va>            !6a href="+code="s_capable" class="sref">"s_capable6/a>(6a href="+code="s" class="sref">ns va>->6a href="+code=user_"s" class="sref">user_"s6/a>, 6a href="+code=CAP_IPC_OWNER" class="sref">CAP_IPC_OWNER6/a>))e.623 va>                return -1;e.6246/a>e.625 va>        return 6a href="+code=security_ipc_permission" class="sref">security_ipc_permission6/a>(6a href="+code=ipcp" class="sref">ipcp va>, 6a href="+code=flag" class="sref">flag va>);e.626 va>}e.6276/a>e.6286/a>6spal class="comment">/*6/spalue.6296/a>6spal class="comment"> * Functions to convert.between the kern_ipc_perm structure and the6/spalue.63n va>6spal class="comment"> * old/new ipc_perm structures6/spalue.6316/a>6spal class="comment"> */6/spalue.6326/a>e.6336/a>6spal class="comment">/**6/spalue.6346/a>6spal class="comment"> *      kernel_to_ipc64_perm    -       convert.kernel ipc permissions to user6/spalue.6356/a>6spal class="comment"> *      @in:.kernel permissions6/spalue.6366/a>6spal class="comment"> *      @out: new style IPC permissions6/spalue.6376/a>6spal class="comment"> *6/spalue.6386/a>6spal class="comment"> *      Turn the kernel object @in into a set of permissions descriptions6/spalue.6396/a>6spal class="comment"> *      for returning to userspace (@out).6/spalue.64n va>6spal class="comment"> */6/spalue.641 va> e.6426/a>e.643 va>void 6a href="+code=kernel_to_ipc64_perm" class="sref">kernel_to_ipc64_perm va> (struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6a href="+code=in" class="sref">in va>, struct.6a href="+code=ipc64_perm" class="sref">ipc64_perm va> *6a href="+code=out" class="sref">out va>)e.644 va>{e.645 va>        6a href="+code=out" class="sref">out va>->6a href="+code=key" class="sref">key va>        = 6a href="+code=in" class="sref">in va>->6a href="+code=key" class="sref">key va>;e.646 va>        6a href="+code=out" class="sref">out va>->6a href="+code=uid" class="sref">uid6/a>        = 6a href="+code=in" class="sref">in va>->6a href="+code=uid" class="sref">uid6/a>;e.647 va>        6a href="+code=out" class="sref">out va>->6a href="+code=gid" class="sref">gid6/a>        = 6a href="+code=in" class="sref">in va>->6a href="+code=gid" class="sref">gid6/a>;e.648 va>        6a href="+code=out" class="sref">out va>->6a href="+code=cuid" class="sref">cuid6/a>       = 6a href="+code=in" class="sref">in va>->6a href="+code=cuid" class="sref">cuid6/a>;e.649 va>        6a href="+code=out" class="sref">out va>->6a href="+code=cgid" class="sref">cgid6/a>       = 6a href="+code=in" class="sref">in va>->6a href="+code=cgid" class="sref">cgid6/a>;e.650 va>        6a href="+code=out" class="sref">out va>->6a href="+code=mode" class="sref">mode6/a>       = 6a href="+code=in" class="sref">in va>->6a href="+code=mode" class="sref">mode6/a>;e.651 va>        6a href="+code=out" class="sref">out va>->6a href="+code=seq" class="sref">seq6/a>        = 6a href="+code=in" class="sref">in va>->6a href="+code=seq" class="sref">seq6/a>;e.652 va>}e.653 va>e.6546/a>6spal class="comment">/**6/spalue.6556/a>6spal class="comment"> *      ipc64_perm_to_ipc_perm  -       convert.new ipc permissions to old6/spalue.6566/a>6spal class="comment"> *      @in:.new style IPC permissions6/spalue.6576/a>6spal class="comment"> *      @out: old style IPC permissions6/spalue.6586/a>6spal class="comment"> *6/spalue.559 6ue6spal class="comment"> *      Freect @in the6store ito a sernel: olnter to palue6spal class="comment"> *    palue6spa href="ipc/util.c#L642" id  L563"6class="line" nam
  L563"6.563666>void 6a href="+code=kern4_perm_to_ipc_perm  - ass="sref">ipc64_perm va>ipc_perm  -  (struct.6a href="+code=kern4_perm" class="sref">ipc64_perm va> *6a href="+code=out"class="sref">in va>, struct.6a href="+code=ipc64_pm" class="sref">ipc64_pm va> *6a href="+code=out" class="sref">out va>)e{e        6a href="+code=out" class="sref">out va>->6a href="+code=key" class="sref">key va>        = 6a href="+code=in" class="sref">in va>->6a href="+code=key" class="sref">key va>;e        6a href="+code=out"SET_UIDass="sref">key SET_UID(6a href="+code=ipcp class="sref">out va>->6a href="+code=uid" class="sref">uid6/a>     href="+code=ipc_dlass="sref">in va>->6a href="+code=uid" class="sref">uid6/a>;e        6a href="+code=out"SET_GIDass="sref">key SET_GID(6a href="+code=ipcp class="sref">out va>->6a href="+code=uid" class="sref">gid6/a>;ein va>->6a href="+code=uid" class="sref">gid6/a>))e        6a href="+code=out"SET_UIDass="sref">key SET_UID(6a href="+code=ipcp class="sref">out va>->6a href="+code=uid"" class="sref">cuid6/a>;ein va>->6a href="+code=uid"" class="sref">cuid6/a>;e        6a href="+code=out"SET_GIDass="sref">key SET_GID(6a href="+code=ipcp class="sref">out va>->6a href="+code=uid"" class="sref">cgid6/a>;ein va>->6a href="+code=uid"" class="sref">cgid6/a>) ||  href="ipc/util.c#L626" id  L570"6class="line" nam
  L570"6.57n 67>        6a href="+code=out" class="sref">out va>->6a href="+code=mode" class="sref">mode6/a>       = 6a href="+code=in" class="sref">in va>->6a href="+code=mode" class="sref">mode6/a>;e        6a href="+code=out" class="sref">out va>->6a href="+code=seq" class="sref">seq6/a>        = 6a href="+code=in" class="sref">in va>->6a href="+code=seq" class="sref">seq6/a>;e}ee6spal class="comment"> * T/spalue6spal class="comment"> * - du4_pmlock   Lock laspermcture and  the olnrw_mutex hespalue6spal class="comment"> * - du@idPC nam
id> *ifitrucspalue6spal class="comment"> * - [o@idc_rcu L5old6look retalue6spal class="comment"> * Thealue6spal class="comment"> * UnliLook ret lasp bh, rnelrcu L5s L5r the6lock allocssociatn bhcu ct.6/spalue6spal class="comment"> * foralue6spal class="comment"> */6/sir lbhcu ct.6/stherlockn bon exispalue6spal class="comment"> *    paluee    ct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6a href="+code=ipcp" cmlockass="sref">ipc64_pmlock(6a hct.6a href="+code=ipc64_pmL5sass="sref">ipc64_pmL5s *6a href="+code=ipcp"5sass="sref">ipc64d>, 6a h6a href="+code=ipcpelass="sref">ipc_r>)e     href="ipc/util.c#L645" id  L586"6class="line" nam
  L586"6.58666a>        voidct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6a href="+code=ipcp class="sref">out va>-> href="ipc/util.c#L652" id  L587"6class="line" nam
  L587"6.587 6a>        if (6a href="+code=ipcplelass="sref">ipc_la> = 6a href="+code=curruti va>omL5xass="sref">ipc64_p va>omL5x(6a href="+code=ipcpelass="sref">ipc_r>)ee        6a href="+code=out"gracreadmlockass="sref">ipc6gracreadmlock(6a h  href="ipc/util.c#L652" id  L590"6class="line" nam
  L590"6.590 69>        6a href="+code=out" class="sref">out va>->a href="+code=currudr_finlass="sref">ipc_r>r_finl(6a h;6a href="+code=cont"5sass="sref">ipc64d>, 6a;6a href="+code=is_vmpcsmL5lass="sref">ipc_rcusmL5l;eipc_la> = 6  href="ipc/util.c#L652" id  L571"6class="line" nam
  L591"6.591 69>        if ((6a ref="+code=out" class="sref">out va>->a  href="+code=curr is ass="sref">out  is  = 6 a href="ipc/util.c#L591"6id  L592"6class="line" nam
  L592"6.592 69>                if (ref="+code=out"gracreadmunlockass="sref">ipc6gracreadmunlock(6a h  href="ipc/util.c#L652" id  L583"6class="line" nam
  L593"6.593669>                return -1;eref="+code=out"ERR_PTlass="sref">CAP_ERR_PTl(6a hhref="+code=contEINVA ass="sref">out EINVA  = 6  href="ipc/util.c#L652" id  L584"6class="line" nam
  L594"6.594669>        6a h href="ipc/util.c#L653" id  L595"6class="line" nam
  L595"6.59566a>6spahref="ipc/util.c#L653" id  L586"6class="line" nam
  L596"6.596669>        6a href="+code=out"spinmlockass="sref">ipc6spinmlock(6a h;6a href="+code=cont class="sref">out va>->6a href="+code=seq"lockass="sref">ipc6lock(6a   href="ipc/util.c#L652" id  L587"6class="line" nam
  L597"6.597669>        if (href="ipc/util.c#L652" id  L658" class="line" nam
  L598"6.598669>        6a hr class="comment">/* is thcu_gmid() may havlocareadye ipce alloI    "line" nam
  L610">.610 va>        int.6a hre   "line" 2="+code=ipcpelass="sref">ipc_r>58" class="line" nam
  L588"6.588 y_ipc_permissnam
  L592"6.592n69>             t1en       6a href="0 was ="+cass=: 58" class="line" nam
76/spalue<7 href="ipc/util.c#L601" 7d  L671" class="line" nam
  L601">.a href="0583 68>eout  is  = 6 a href="ipc/util.c#Lode=ipc_rcu_sched" cleleta>);eipc6lock(6a   href="ipc/util.c#L652" id  L587"6class="line" nam
  L597"6.597669>        if (href="ipc/u76/spalue<7 href="ipc/util.c#L604" 7d  L670R_PTl(6a hhref="+codehref="ipc/util.c#L652" id  L583"6class="line" nam
  L593"6.593669>                return 7      @fl7g will most probably be 7 or S70container_of6/a>(6a h=contEINVA ass="sref">out EINVA  = 6  href="ipc/util.c#L652" id  L584"6class="line" nam
  L594"6.594669>        6a h href="ipc/7/6/spalue7a href="ipc/util.c#L606"7id  L70595"6.59566a>6spahref="ipc/util.c#L6707" id  L707" class="line" nam
  L707">.70 va>        if (6a href="+c7rms" clas7="sref">ipcperms6/a>(str7ct.6a7ode=ipc_rcu_sc50" id  L550" class="line" nam
  L550">.550 va>}e.709 va>6spahref="ipc/util.c#L6709" id  L70 y_ipc_permissnam
  L597f="+c7de=euispahref="ipc/util.c#L67de=reques7ed_mode" class="sref">re7ueste7_mode6 href="+code=ipcp" cmlockass="sref">ipc64_pmlock(6a hct.6a href="+code=ipc64_pmL5sass="sref"_"line>ipc64_pmL5s *6a href="_"line+code=ipcp"5sass="sref">ipc64d>, 6a h6a href="+code=ipcpelass="sref">ipc_r>)e     href="ipc/util.c#L72" id  L672" class="line" nam
  L672">.672 va>                 if (ref7udit_ipc_7bj" class="sref">audit_i7c_obj71sched6/a> *6a href="+code=sched" cls="sref">out va>-> href="ipc/util.c#L652" id  L587"6class="line" nam
  L587"6.587 6a>        if (6a href="+c7equested_7ode" class="sref">reques7ed_mo71 6a>    ct.6a href="+code=k7ranted_mo7e" class="sref">granted_7ode6/7> = 6a href="+code=ipcp" clas>r_finl(6a h;6a href="+code=cont"5sass="sref="sref">ipc64_pmL5s *6a href="+code"sref">ipc_r>)eeeuid6/a> == 7a hre7="+code=ipcp" class="sref">ipcp vIS_ipc" nam
  L588"6.IS_ipcclass="sref">cgid6/a>;eeuid6/a> == 7a hre7="+code=ipcp" clasu_sc50" id  L550" class="line" nam
  L550">.550 va>}e7rante716/a>6spal class="comment">/7="+code=i7_group_p" class="sref">i7_grou7_p6/a>(6a hrefde=ipcp" class="sref hr"linene" nam
  L588"6.5 hr"lineneclass="sref">cgid6/a>;e9>                if (ref7"+code=gr7nted_mode" class="sref">7rante7_mode6/a> >>= 3;ecgid6/a>;e/* 7s there some bit set in 7eques7ed_mode but no/a>(6a h=contEINVA ass="sref">out EINVA  = 6  href="ipc/util.c#L652" id  L584"6claDRMline" nam
  L594"DRM_dla>}er7quest7d_mode6/a> &am6spahref="ipc/util.c#L67ode="s_ca7able" class="sref">"s_ca7able672 va>void 6a href="+code=ker71;e.550 va>}e.675 va> 6spahref="ipc/util.c#L67oe=euid" 7rity_ipc_permission" cla7s="sr72669>        6a href="+code=727" id  L727" class="line" nam
  L727">.72ipc/util.c#L599"6id  L577"66.575 6a>6spal class="comment"> 78" id  L678" class="line" nam
  L678">.672pc/util.c#L599"6id  L658" clas="cget - C L6600"ys_*get   c571 6 6a>6spal class="comment"> 78"+code=i7 href="ipc/util.c#L629" 7d  L679" class="line" nam
  L629">lassns :c#L6se">.5986/a>6spal class="comment"> 7 Function7 to convert.between the 7ern_i7c_perm structure and the6/spaluss=" line" nam
  L577"6.57766a>6spal class="comment"> 7 old/new 7pc_perm structures6/spal7e6spal class="comment"> 7/6/spalue7a href="ipc/util.c#L632"7id  L732" class="line" nam
  L632">.ine" nam  L5furclass"line6586/a>6spal class="comment"> 7/de="s_ca73" class="line" nam
  L673">.673d6/spalue 7*6/spalue7a href="ipc/util.c#L634"7id  L734" class="line" nam
  L634".58166a>6spal class="comment"> 7      ker7el_to_ipc64_perm    -   7   co7vert.kernel ipc permissions to C L6600r550pernam
  L5byi"ys_msgget  ,i"ys_semget     L56ys_shmget  582 68>6spal class="comment"> 7*e=euid" 7.kernel permissions6/spa7ueeipc64d>ermins va>, struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6a href="+code=ipcp" cla64d>, 6a h6a href="+code=ipcpelass="sref">ipc_r>)econtainer_of6/a>(6a href="+co href="+code=ipcp" cla64d>op"a h6a href="+code=iop"2" id  L587"6class="lip"a h6a href="+coop"2" icode=out" class="sref">out vaarL6sa h6a href="+code=iaarL6s2" id  L587"6class="laarL6sa h6a href="+coaarL6s2" i                return 7      Tur7 the kernel object @in i7to a 739 va>        6a href="+code=7      for7returning to userspace (7out).7" nam
  L540">de=ipcp" class="sreaarL6sa h6a href="+coaarL6s2" in" class="sref">in va>->6a href="+code=key"91"6id  L592"6clasL623PRIVATE" nam
  L588"6.I623PRIVATE2" i                return 7/6/spalue7a href="ipc/util.c#L641"7id  L74d_mode but no/a>(6a h=contEINVA ass="sref">5 hget_new3"6class="line"5 hget_newclass="sref">cgid6/aef">kern_ipc_perm va> *6a"sref">ipc_r>)e.74_mode6/a> &am="+ce.67a href="ipc/util.c#L54=contEINVA ass="sref">5 hget_publilass="line" nam
  hget_publilclass="sref">cgid6/aef">kern_ipc_perm va> *6a"sref">ipc_r>)eker7el_to7446/a>e.74 va>        return 6a href=7ut" class7"sref">out va>->6a hr7f="+c746" class="line" nam
  L596">.5966/a>6spal class="comment"> 7ut" class7"sref">out va>->6a hr7f="+c74ipc/util.c#L599"6id  L577"6cla5 hrdpdatetil.c#- dpdatei+codp659" id  L56f hreI62582 68>6spal class="comment"> 7ut" class7"sref">out va>->6a hr7f="+c74pc/util.c#L599"6id  L658" class=n: i+codp659" id   given as inpu.582 68>6spal class="comment"> 7ut" class7"sref">out va>->6a hr7f="+c74" class="line" nam
  L629">lasso" cl+codp659" id   6f /util.c#ine">.60n va>6spal class="comment"> 7ut" class7"sref">out va>->6a hr7f="+c74_perm structure and the6/spal583 68>eout va>->6a hr7f="+c7de=modd *6a href="+code=ptr" cdpdatetil.c3"6class="line"5 hrdpdatetil.c+code=ipcp"5sass="sref">ipc64dn va>, struct.6a href="+code=ipc64_pm" class="sref">ipc64_pm va> *6a href="+code=out" class="sref">os="sref">out va>-> href="ipc/util.c#L652" id  L587"6class="line" nam
  L587"6.587 6a>                return 7ut" class7"sref">out va>->6a hr7f="+c75 va>                 if (ref753" id  L753" class="line" nam
  L753">.75a>(6a href="+code=ipcp" clask(6a   href="ipc/util.c#L652" id  L587"6classa>->6a href="+code=uid""sref">uid6/a>;e.647 va>        6a href="+code=74" id  L674" class="line" nam
  L674">.6756/a> = (6a href="+code=flag"k(6a   href="ipc/util.c#L652" id  L587"6classa>->6a href="+code=gid""sref">gid6/a>;e.648 va>        6a href="+code=7*6/spalue7a href="ipc/util.c#L655"7id  L7>(6a href="+code=ptr" class=">       = 6a href="+code=in" class="sref">in va>->6a href="+code=mode"code=flag" class=">       = 6a href="+code=in" class="sref">in va>->6a href="+code=mode" 0007) && e.5ode=flag" class="se" 0007)&& ee/76/spalue<7 href="ipc/util.c#L659" 7d  L679" class="line" nam
  L659">>.5966/a>6spal class="comment"> 7" idTurn 7he kernelstyle IPC issio7s to 7ct @in into a set .c#patibility="cctl_pre_down#- =corie hren2"6cl  L5"line"="line" nam
  L6ef="iI623XXX cm91 ipc_r>58" class="line" nam
7      Fre7ct @in the6store ito a s7rnel:7olnter to palue58" class="line" nam
7 t" class7a href="ipc/util.c#L641"7id  L762"6class="line" nam
  L562"6.ass="li /utit_"s" 6f s=" w58" class="line" nam
7 3" id  L763"6class="line" nam
  L763"6.763" class="line" nam
  L563"lass="lin /utild 6f /util.c#ine=corie hn_ipc_r>58" class="line" nam
7 " id  L67ipc_perm  - ass="sref">i7c64_p76/spalue58" class="line" nam
7 6/spalue765"6class="line" nam
  L765"6.7 work vspalue.+cipc_r>58" class="line" nam
7 t" class7"sref">out va>->6a hr7f="+c766" class="line" nam
  L566">.5@extra_="liclone extradp659" id   parL6eterne" L5byimsq+cipc_r>58" class="line" nam
7 t" class7ass="sref">key SET_UID(67 href7 bh, vspaluekey SET_GID(67 href7ork().6/spaluekey SET_UID(67 href769" class="line" nam
  L569">.icm9"  L5im
am
  L5ass="semctl_down#L60mctl_down"  L5msgctl_down60n va>6spal class="comment"> 7ut"SET_GI7ass="sref">key SET_GID(67 href76t @in into a set .c#patibilityIt mustcbenam
  L5"line" nany580"6c"6.5"  L0n va>6spal class="comment"> 7ut" class7"sref">out va>->6a hr7f="+c77lnter to palue6spal class="comment"> 7ut" class7"sref">out va>->6a hr7f="+c772" class="line" nam
  L632">.in-5="l  Lms6ef="i"ipc/l  L5="line" na
"line, dependss="opc/utigiven cm91 ipc_r>58" class="line" nam
753" id  L773"6class="line" nam
  L773"6.77d6/spalue.6026/a>6spal class="comment"> 74"6id  L574"6class="line" nam
  L574"6.577/spalue6spal class="comment"> 7u6/spalue7a href="ipc/util.c#L655"7id  L775"6class="line" nam
  L575"al583 68>eipc64_pmlock(6a hct.6a href="+code=ipc64_pmL5sass="ctl_pre_downstruct.6a href="+cctl_pre_down+code=ipcp"5sass="sref">ipc64d>ermins va>, struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *6 *ifitrucspalue<7 href7>data va>[0]);e, 6a h6a href="+code=ipcpelass="sref">ipc_r>)e id  L585"6class="lincm9 nam
  L585"6.5cm91  *6, struct.6a href="+code=ipc64_pm" class="sref">ia>, struct.6a href==ipc64_p id  L585"6class="linextra_="listruct.6a href=extra_="li 6a>                return 7 Thealue<7 href="ipc/util.c#L599"67d  L6779 va>        6a href="+code=7 UnliLook7ret lasp bh, rnelrcu L5s7L5r t7/a>(&6a hr href="+code=ipcp" class="sref">ipcp va>, short.6a href="+code=flag" class="sref">flag va>)eipc_r> = 6a href="+code=current_euid" class="sref">current_euid6/a>();evoid 6a href="+code=ker74"6id  L574"6class="line" nam
  L574"6.5786/a> = (6a href="+code=flag"down_writa>, struct.6a hrdown_writa+codecsmL5lass="sref">ipc_rcusmL5l;eiam
  L57usmL5l;e         6a href="+code=7rn_ipc_pe7m" class="sref">kern_ipc7perm 78(6a href="+code=ptr" class="ag va>)eipc64_pmL5s *6a href="_"line+code"sref">ipc_r>)eeipcp vIS_ipc" nam
  L588"6.IS_ipcclass="sref">cgid6/aag va>)e7ern_i78data va>[0]);ecgid6/aag va>)eipc_la> = 6a 7ref="78container_of6/a>(6a hgoinee=flag" class=">  _uva>)e(&6a hrefeipc6gra7readm78e=euispahref="ipc/util.c#L67ut" class7"sref">out va>->a href7"+cod7=currudr_finlass="sref">ipc_rs="sref">ipcp va>);e.613 va>        6a href="+code=7de=out" c7ass="sref">out va>->a 7href=7+code=curr is ass="sref">out  is cm9 nam
  L585"6.5cm91  *"91"6id  L592"6clasL623SET" nam
  L588"6.I623SET 6a>                return 7"+code=ou7"gracreadmunlockass="sre7">ipc7gracreadmunlock(6a h  href="ipc/util."ipc/util.set_pipcp va>, short.6a"ipc/util.set_pipc613" id  L613" classextra_="listruct.6a href=extra_="li 6a>co L587"6class="la>, struct.6a href==ipc64_p="sref">in va>->6a href="+code=uid" class="               return 7""6id  L57ode=out"ERR_PTlass="sref7>CAP_7RR_PTl(6a hhref="+codeeeeeeeeeeeeeeeeeeeeeeeeee L587"6class="la>, struct.6a href==ipc64_p="sref">in va>->6a href="+code=uid" class="sref">gid6/a>))ea>, struct.6a href==ipc64_p="sref">in va>->6"line" nam
  L571"6.571 67>>        6a href="+code=7dn_ipc_pe7" id  L595"6class="line"7nam
 756/a>6spal class="comment">/73" id  L576"6class="line" nam
  L576"6.579e=key" class="sref">key va> >current_euid6/a>();e.610 va>        int.6a href="+c7ut"spinml7ckass="sref">ipc6spinmlo7k(6a 7;6a href="+codclass="sref">ipcp va>->6a href="+code=cuid" class="sref">cuid6/a> ||e.616 va> ss="sref">ipcp va>->6a href="+code=uid" class="sref">uid6/a>)e.617 va> a>            6a href="+c7il.c#L6527 id  L658" class="line" 7am
  79container_of6/a>(perm" class="srefs va>->6a href="+code=user_"s" class="sref">user_"s6/a>, 6a href="+code=CAP_IPC_OWNER" class="sref">CAP_IPC_OWNER6/a>))e9           6a href="+c7iThealue<7s thcu_gmid() may havloc7ready7 ipce alloI           =contEINVA ass="sref">5 hva>)eipc_rer= 6  href="ipc/uer= hrede=652" id  L584"6clPERMline" nam
  L594PERMil.c        6a href="+code=8      Che8k user, group, other per8issio80e=seq" class="sref">seq6/a> i hrd  L583"6class="line"5 hrd  L58class="sref">cgid6/a="line" nam
  L613">.613 va>        6a href="+code=8      to 8pc resources. return 0 i8 allo80racree=flag" class=">  _uva>)e = (6a href="+code=flag"up_writa>, struct.6a hrup_writa+codecsmL5lass="sref">ipc_rcusmL5l;eiam
  L57usmL5l;e         6a href="+code=8      @fl8g will most probably be 8 or S80container_of6=contEINVA ass="sref">out EINVA  = 6  href="ipc/util.c#Lss="sref">ipc_rer= 6  href="ipc/uer= hre         6a href="+code=8 5    @fl8g"6class="line" nam
  L58id  L80595"6e.80 va>        if (6a href="+c8rms" clas8="sref">ipcperms6/a>(str8ct.6a8ode=ip#ifdef="ipc/util.c#L623ONFIG_ARCH_WANT L623PARSE_VERSIONCAP_IPC_OWNER6/3ONFIG_ARCH_WANT L623PARSE_VERSIONva>        if (6a href="+c8r8s" clas8= thcu_gmid() may havloc809">.80 68>        6a href="+code=809" id  L80 y_ipc_permissnam
  L598f="+c8de=euispahref="ipc/util.c#L68de=reques8ed_mode" class="sref">re8ueste81lnter to palue 82" id  L682" class="line" nam
  L682">.6812" class="line" nam
  L632">.ine" nie=iaarse_ver" na






656" id ne" am
  ver" na966/a>6spal class="comment"> 82     to 8bj" class="sref">audit_i8c_obj81d6/spalue6spal class="comment"> 8equested_8ode" class="sref">reques8ed_mo814" class="line" nam
  L634".58166a>6spal class="comment"> 8ranted_mo8e" class="sref">granted_8ode6/81ert.kernel ipc permissions to user6RcontEIL62364"  L6ass="line" nam  L5L623"LD"  L6ass="line" na. 8166a>6spal class="comment"> 8r5    @fl8lass="sref">euid6/a> == 8a hre81ert.new ipc permissions to old6/spaL572@cm9fva.us=ne"ontE L5ass="hreenc#Lss="/umm  Lm  L5ver" na
="li8166a>6spal class="comment"> 8r7" id  L8lass="sref">euid6/a> == 8a hre81ue6spal class="comment"> 8"+code=gr8nted_mode" class="sref">8rante81rk().6/spaluei8_grou8_p6/a>(8rante8_mode6+code=ipc_nam
space" ciaarse_ver" na3"6class="line"5 hraarse_ver" na6/a>((+cod class="sref">flcm9 nam
  L585"6.5cm91  *9           6a href="+c8ment">/* 8s there some bit set in 8eques8ed_mod                if (ref8m" id  L68ted_mode" class="sref">r8quest8d_mode6/a> & ~ class="sref">flcm9 nam
  L585"6.5cm91  *" 0007)&& e                if (ref8ode="s_ca8able" class="sref">"s_ca8able68a>(6a href="+code===== class="sref">flcm9 nam
  L585"6.5cm91  *"^1"6id  L592"6clasL62364" nam
  L588"6.I623 work         6a href="+code=81;e.6246/6id  L592"6clasL62364" nam
  L588"6.I623 work         6a href="+code=81anted_mo85" class="line" nam
  L685">.682595"6.59566a>6m="+c>                if (ref8o5    @fl8rity_ipc_permission" cla8s="sr82"line" nam
  L586">.5>.6246/6id  L592"6clasL623"LD" nam
  L588"6.I623"LDork         6a href="+code=817" id  L827" class="line" nam
  L827">.826a href="+code.682pc/ute        6a href="+code=8 Function8 to convert.between the 8ern_i8c_perm#endsf  "line" nam
  L610">.610 3ONFIG_ARCH_WANT L623PARSE_VERSIONti583 68>e.683d6/spde=out" class="sref">out varoc_ita= 6  href="ipc/utilvaroc_ita=a hre                if (ref8*6/spalue8a href="ipc/util.c#L634"8id  L83ss="line" nam=ipcp"5sass="sref">ipc64d>ermins va>, struct.6a href="+code=kern_ipc_perm" class="sref">kern_ipc_perm va> *        6a href="+code=8      ker8el_to_ipc64_perm    -   8   co834s="line" nam=ipcp"5sass="sref">ipc64d>aroc_if va>, struct.6a href="aroc_if vaflag" class="sref">flaf va>, struct.6a href vaflag        6a href="+code=8 5    @fl8.kernel permissions6/spa8ue        if (6a href="+c8 " id  L68 href="ipc/util.c#L638" 8d  L688" class="line" nam
  L638">/58166a>6spal class="comment"> 8      Tur8 the kernel object @in i8to a 8et of permissions descriptions6Thim
r550pern80"6sc/util.c#76"6class=fou Lm t leastca  L5sihref L5s60n va>6spal class="comment"> 8      for8returning to userspace (8out).8/spalueipcp va>, short.6a href="+code=flag" class="sref">flsysv="+cde=if="+p va>, short.6asysv="+cde=if="+l.c#L href="+code=ipcp" cla64d>, 6a h6a href="+code=ipcpelass="sref">ipc_r>)eipc_r>)eloff 6a href="+code=cloff 6elassref">gid6/a>))eaosa h6a href="+coaova> *6.84_mode6/a> &ammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"sref">ipc_r>)eloff 6a href="+code=cloff 6elass_perm" class="sreew_aosa h6a href="+coeew_aos1  *9           6a href="+c84de="s_ca83" class="line" nam
  L683">.68a href                if (ref846/spalue84_perm" class="sref">ker8el_to84ss="line" nam=ipcp"5sass="sref">ipcss="sref">ipcp va>, short.6a href="+code=flag" class="sref">flag a h6a href="+code=flag        6a href="+code=845" id  L845" class="line" nam
  L845">.844s="line" nam+code=ipc_nam
spacetotala h6a href="+cototal617" iL658" class="line" nam
  L588"6.588 6a        6a href="+code=845    @fl8"sref">out va>->6a hr8f="+c84669>        6a href="+code=8ut" class8"sref">out va>->6a hr8f="+c8de=uid" class="sref">uid6/a> totala h6a href="+cototal617" = 0        6a href="+code=84" id  L68"sref">out va>->6a hr8f="+c8de=gid" class=  L6 L658" class="line" nam
  L588"6.588 6a = 0 iL658" class="line" nam
  L588"6.588 6a < iL658" class="liaosa h6a href="+coaova> *" 0007 0007)&& eipn_usa>, struct.6a hren_usa8 6a iL658" class="line" nam
  L588"6.588 6a++9>                if (ref8ut" class8"sref">out va>->6a hr8f="+c84ipce alloI           class="sref">flag a h6a href="+code=flagde=cont"5sass="sref">ipc64d>, 6a;6a href="+code=is_vmpcsmL5lass="sref">ipc_rcusmL5l;eipc_la> = 6  href="ipc/util.c#L652" id  L571"6class="ne" nam
  L588"6.588 6a>eout va>->6a hr8f="+c84mode6/a> >>= 3;de=ipcp" class="sref ha h6a href="+code=flagd!1"6id  L592"6class="line" nam
  L592"6.592 69out va>->6a hr8f="+c85d_mode but no/a>(6a h" class="sref">uid6/a> totala h6a href="+cototal617"++eout va>->6a hr8f="+c85_mode6/a> &am6spahref="ipc/util.c#L6853" id  L853" class="line" nam
  L853">.85 va>void 6a href="+code=ker84" id  L684" class="line" nam
  L684">.6856/a> = (6a hrde=ipcp" class="sretotala h6a href="+cototal617" &pc_e=cont"5sass="sref"cusmL5l;eipn_usa>, struct.6a hren_usa8 6a9(6a href="+cooooooooo>.6246/6id  L592"6class="line" nam
  L592"6.592 6e *" lt iL658" class="liIPCMNI" nam
  L588"6.I62MNI8 6a iL658" class="liaosa h6a href="+coaova> *++9>                if (ref8      @ou8: old style IPC permissi8ns6/s85container_of6/a>(6a hclass="sref">flag a h6a href="+code=flagde=cont"5sass="sref">ipc64d>, 6a;6a href="+code=is_vmpcsmL5lass="sref">ipc_rcusmL5l;eipc_la> = 6  href="ipc/util.c#L652" id  L571"6class="aosa h6a href="+coaova> *>e                if (ref8 t" class8he kernelstyle IPC issio8s to 85mode6/a> >>= 3;;;;;;;;;_perm" class="sreew_aosa h6a href="+coeew_aos1  *de=cont"5sass="sreaosa h6a href="+coaova> *"+ 1euid6/a> i href="_by_pt= 6  href="ipc/utilvef="_by_pt=class="sref">cgid6/a="la h6a href="+code=flag>e &ammmmmmmmmmmmmmmmm=contEINVA ass="sref">5 ha h6a href="+code=flag        6a href="+code=8 3" id  L863"6class="line" nam
  L863"6.86>(6a href="+code=====6spahref="ipc/util.c#L68 " id  L68ipc_perm  - ass="sref">i8c64_p863mode6/a> &am6spahref="ipc/util.c#L68 6/spalue865"6class="line" nam
  L865"6.866/a>6spal class="comment">/8 t" class8"sref">out va>->6a hr8f="+c8de=key" class=""line" nam
  L610">.610 Out 6f range6-4=contE "6.5"ipct"linnateiita=ahref64583 68>ekey SET_UID(68 href8"+code=ipcp cl>.6246/6id  L592"6class="line" nam
  L592"6.592 6ekey SET_GID(68 href86pc/utekey SET_UID(68 href86 68>        6a href="+code=8ut"SET_GI8ass="sref">key SET_GID(68 href86t @in haticrd *6a class="sref">flsysv="+caroc_nex6a href="+code=csysv="+caroc_nex6l.c#L href="+code=ipcp" claseqode>6a href="+codseqode&gflag" class="sref">flst;6a href="+cods52" idd *6a class="sref">flit3"6class="line"5c_dla iL658" class="liloff 6a href="+code=cloff 6elass_perm" class="sraosa h6a href="+coaova> *>       6a href="+code=8ut" class8"sref">out va>->6a hr8f="+c87d_mod                if (ref8ut" class8"sref">out va>->6a hr8f="+c8de=seq" class=de=out" class="sref">out varoc_ita= 6  href="ipc/utilvaroc_ita=a hre class="sref">flita= 6  href="ipc/utta=a hree=cont"5sass="srest;6a href="+cods52" =ipc_lelass="sref">iprivata>, struct.6a hrprivata92 6e *6a href="+code=sched" cl64d>aroc_if va>, struct.6a href="aroc_if vaflag" class="sref">flaf va>, struct.6a href vaflagde=cont"5sass="srefta= 6  href="ipc/utta=a hr=ipc_lelass="sref">ipf va>, struct.6a href vaflag        6a href="+code=84"6id  L584"6class="line" nam
  L584"6.587ss="line" nam=ipcp"5sass="sref">ipcss="sref">ipcp va>, short.6a href="+code=flag" class="sref">flag a h6a href="+code=flagde=cont"5sass="sreft3"6class="line"5c_dla        6a href="+code=846/spalue8a href="ipc/util.c#L655"8id  L876/a>6spal class="comment">/8 - du4_pm8ock   Lock laspermcture 8nd  t87e=key" class=""line" nam
  L610">.610 If we hadren2"6clid" nam
  be  Le, d  L58iit64583 68>e *ifitrucspalue<8 href876a href="+codclass="sref">ipcp vag a h6a href="+code=flagd 0007 0007)&& e *>       6a href="+code=8u     @ou8rcu L5old6look retalue(6a h+code=sched" cl64d>d  L583"6class="line"5 hrd  L58class="sref">cgid6/a="la h6a href="+code=flag>e        6a href="+code=8 UnliLook8ret lasp bh, rnelrcu L5s8L5r t8/a>(&6a hr>.6246/6id  L592"6classysv="+cde=if="+p va>, short.6asysv="+cde=if="+l.c#LcsmL5lass="sref">ipc_ta= 6  href="ipc/utta=a hr=ipc_lelass="sref">is6/a>, 6a href="+code=CAP_IPC_OWNER" class=_rcusmL5l;eipf va>, struct.6a href vaflagAP_IPC_OWNER" class=_rcusmL5l;e *id  L571"6class="aosa h6a href="+coaova> *>e6spal class="comment"> 84"6id  L584"6class="line" nam
  L584"6.588/spalue6spal class="comment"> 8rn_ipc_pe8m" class="sref">kern_ipc8perm 88ert.kernel ipc permissions to SeqFpelaita=ahor:aita=ahorfva.us= nam
  "6clL561"6."orfSEQ_TOKEN_START60n va>6spal class="comment"> 8r- du4_pm886"6class="line" nam
  L886"6.88ef="ipc/util.c#L636" id  L636583 68>e8ern_i88data  haticrd *6a class="sref">flsysv="+caroc_ har6a href="+code=csysv="+caroc_ har6l.c#L href="+code=ipcp" claseqode>6a href="+codseqode&gflag" class="sref">flst;6a href="+cods52" idL658" class="liloff 6a href="+code=cloff 6elass_perm" class="sraosa h6a href="+coaova> *>       6a href="+code=84     @ou8ass="sref">ipc_la> = 6a 8ref="88conta                if (ref8 Thealue<89"6class="line" nam
  L589"6.58>(&6a hrefde=out" class="sref">out varoc_ita= 6  href="ipc/utilvaroc_ita=a hre class="sref">flita= 6  href="ipc/utta=a hree=cont"5sass="srest;6a href="+cods52" =ipc_lelass="sref">iprivata>, struct.6a hrprivata92 6eipc6gra8readm88a>(&6a hr href="+code=ipcp" cla64d>aroc_if va>, struct.6a href="aroc_if vaflag" class="sref">flaf va>, struct.6a href vaflagde=cont"5sass="srefta= 6  href="ipc/utta=a hr=ipc_lelass="sref">ipf va>, struct.6a href vaflag        6a href="+code=8ut" class8"sref">out va>->a href8"+cod8=currudr_finla href="+code=ipcp" cla64d>, 6a h6a href="+code=ipcpelass="sref">ipc_r>)eout va>->a 8href=89code=ipc89a>(6a href="+code=ipcp" clasipc_ta= 6  href="ipc/utta=a hr=ipc_lelass="sref">is6/a>, 6a href="+code=CAP_IPC_OWNER" class=_rcusmL5l;eipf va>, struct.6a href vaflagAP_IPC_OWNER" class=_rcusmL5l;eCAP_89 6a>    ct.6a href="+code=k8dn_ipc_pe8" id  L595"6class="line"8nam
 8L595"6.59566a>ass="line" nam
  L583"/58166a>6spal class="comment"> 83" id  L586"6class="line" nam
  L586"6.589ef="ipc/util.c#L636" id  L6333333333* Takei+cod L58i-i+cis whrefber>.leas L5byi+codcorrespondss=8166a>6spal class="comment"> 83code=ker8ckass="sref">ipc6spinmlo8k(6a 89ue6spal class="comment"> 8il.c#L6528 id  L658" class="line" 8am
  89rk().6/spalueipc_rcusmL5l;eiam
  L57usmL5l;e         6a href="+code=8 L588"6.588 y_ipc_permissnam
  L598"6.5989e=euispahref="ipc/util.c#L696/spalue<9 href="ipc/util.c#L601" 9d  L690currudr_finlas"line" nam
  L610">.610 L5s  lt i0=ne"inva.593*583 68>e *  lt i0>       6a href="+code=9      to 9pc resources. return 0 i9 allo90racreadmunlock(6a h  >.6246/6id  L592"6class="line" nam
  L592"6.592 6eass="line" nam
  L583"/5 L5s ==i0=means header3*583 68>eass=_perm" class="sraosa h6a href="+coaova> * ==i0>       6a href="+code=9 6    @fl9gkass="sref">ipc6spinmlo907">.90"+code=ipcp" clasu_sc50" id  L550" class="lSEQ_START_TOKENCAP_IPC_OWNER6/SEQ_START_TOKENa> *e6spal class="comment">/9r8s" clas9= thcu_gmid() may havloc909">.90895"6.59566a>ass="line" nam
  L583"/5 Findi+cod(aov-1)in "6cl*583 68>e, short.6asysv="+cde=if="+l.c#Llass="sref">ipc_rcusmL5l;e * A 1id  L571"6class="aosa h6a href="+coaova> *>ere9ueste91currue.691code=audit_i9c_obj912ata  haticrd *6aclass="sref">flsysv="+caroc_ hova>)eflst;6a href="+cods52" idd *6a class="sref">flit3"6class="line"5c_dla>       6a href="+code=9equested_9ode" class="sref">reques9ed_mo914" cl                if (ref9ranted_mo9e" class="sref">granted_9ode6/914s="line" nam=ipcp"5sass="sref">ipcss="sref">ipcp va>, short.6a href="+code=flag" class="sref">flag a h6a href="+code=flagde=cont"5sass="sreft3"6class="line"5c_dla        6a href="+code=9r5    @fl9lass="sref">euid6/a> == 9a hre9="+code=ipcp" de=out" class="sref">out varoc_ita= 6  href="ipc/utilvaroc_ita=a hre class="sref">flita= 6  href="ipc/utta=a hree=cont"5sass="srest;6a href="+cods52" =ipc_lelass="sref">iprivata>, struct.6a hrprivata92 6eeuid6/a> == 9a hre9="+code=ipcp"  href="+code=ipcp" cla64d>aroc_if va>, struct.6a href="aroc_if vaflag" class="sref">flaf va>, struct.6a href vaflagde=cont"5sass="srefta= 6  href="ipc/utta=a hr=ipc_lelass="sref">ipf va>, struct.6a href vaflag        6a href="+code=9"+code=gr9nted_mode" class="sref">9rante917+code=ipcp"  href="+code=ipcp" cla64d>, 6a h6a href="+code=ipcpelass="sref">ipc_r>)ei9_grou91 68>        6a href="+code=9=9" id  L9nted_mode" class="sref">9rante9_mode6/a> >""line" nam
  L610">.610 If we hadre= nam
  76"6class,r>.leas iit64583 68>e/* 9s there some bit set in 9eques9ed_mode but noclass="sref">ipcp vag a h6a href="+code=flagd 0007 0007)&& e *>       6a href="+code=9m" id  L69ted_mode" class="sref">r9quest92_mode6/a> &ammmmmmmmm+code=sched" cl64d>d  L583"6class="line"5 hrd  L58class="sref">cgid6/a="la h6a href="+code=flag>e"s_ca9able692 va>void 6a href="+code=ker91;eipc_ta= 6  href="ipc/utta=a hr=ipc_lelass="sref">is6/a>, 6a href="+code=CAP_IPC_OWNER" class=_rcusmL5l;eipf va>, struct.6a href vaflagAP_IPC_OWNER" class=_rcusmL5l;e.692595"6.59566a>ass="line" nam
  L583"/5 R.leas i+cod L58iwhr
 ok"ipc har6()64583 68>eipc_rcusmL5l;eiam
  L57usmL5l;e         6a href="+code=917" id  L927" class="line" nam
  L927">.9276/a>e.6926/a>6spal class="comment">/98"+code=i9 href="ipc/util.c#L629" 9d  L692 68>  haticr+code=ipc_nam
spacesysv="+caroc_ how3"6class="line"sysv="+caroc_ howl.c#L href="+code=ipcp" claseqode>6a href="+codseqode&gflag" class="sref">flst;6a href="+cods52" idd *6a class="sref">flit3"6class="line"5c_dla>       6a href="+code=9 Function9 to convert.between the 9ern_i9c_perm                if (ref9 old/new 9pc_perm structures6/spal9earoc_ita= 6  href="ipc/utilvaroc_ita=a hre class="sref">flita= 6  href="ipc/utta=a hree=cont"5sass="srest;6a href="+cods52" =ipc_lelass="sref">iprivata>, struct.6a hrprivata92 6eout varoc_if va>, struct.6a href="aroc_if vaflag" class="sref">flaf va>, struct.6a href vaflagde=cont"5sass="srefta= 6  href="ipc/utta=a hr=ipc_lelass="sref">ipf va>, struct.6a href vaflag        6a href="+code=9 de="s_ca93" class="line" nam
  L693">.693 va>void 6a href="+code=ker9*6/spalue9a href="ipc/util.c#L634"9id  L93ss="line" namclass="sref">ipcp vat3"6class="line"5c_dlaclass="sref">uid6/aSEQ_START_TOKENCAP_IPC_OWNER6/SEQ_START_TOKENa> *>       6a href="+code=9      ker9el_to_ipc64_perm    -   9   co93(6a href="+cooooooooo>.6246/6id  L592"6classeqoputst;6a href="+codseqoputsclass="sref">cgid6/ast;6a href="+cods52" idL658" class="lipf va>, struct.6a href vaflagAP_IPC_OWNER" class=header>, struct.6a hrheader 6a>         6a href="+code=9 5    @fl9.kernel permissions6/spa9ue        6a href="+code=9 7" id  L9: new style IPC permissi9ns6/s93+code=ipcp cl>.6246/6id  L592"6claspf va>, struct.6a href vaflagAP_IPC_OWNER" class= how3"6class="line"showl.c#L="sref">cgid6/ast;6a href="+cods52" idL658" class="lipt3"6class="line"5c_dla>        6a href="+code=9 " id  L69 href="ipc/util.c#L638" 9d  L693pc/uteoseqoopa=ahrefst;6a href="+codseqoopa=ahrefscode=e=ipc_nam
spacesysv="+caroc_ eqip"a h6a href="+cosysv="+caroc_ eqip"flagde=                if (ref9/6/spalue9a href="ipc/util.c#L641"9id  L94d_mode but no.e=ipc_nam
spaceshar6a href="+code=cshar6l.c#ee=cont"5sass="sresysv="+caroc_ har6a href="+code=csysv="+caroc_ har6l.c#6.94_mode6/a> &am.e=ipc_nam
spaceshova>)e)e.69a href="ipc/ut.e=ipc_nam
spacenex6a href="+code=cnex6l.c# ee=cont"5sass="sresysv="+caroc_nex6a href="+code=csysv="+caroc_nex6l.c#6ker9el_to94ss="line" nam.e=ipc_nam
spaceshow3"6class="line"showl.c# ee=cont"5sass="sresysv="+caroc_ how3"6class="line"sysv="+caroc_ howl.c#6.944s="l}        6a href="+code=945    @fl9"sref">out va>->6a hr9f="+c94669>        6a href="+code=9ut" class9"sref">out va>->6a hr9f="+c94data  haticr+code=ipc_nam
spacesysv="+caroc_opaa3"6class="line"sysv="+caroc_opaal.c#L href="+code=ipcp" clainoine" nam
  L571"6inoinflag" class="sref">flanoine" nam
  L571"6inoinflagcode=out" class="sref">ode>6a href="+codde&gflag" class="sref">flde>6a href="+codde&gflag>       6a href="+code=94" id  L69"sref">out va>->6a hr9f="+c94conta                if (ref9ut" class9"sref">out va>->6a hr9f="+c94ipce alloI   +code=ipc_nam
space>.6usmL5l;eout va>->6a hr9f="+c94a>(&6a hr href="+code=ipcp" claseqode>6a href="+codseqode&gflag" class="sref">flseqt;6a href="+codseq_dla        6a href="+code=9ut" class9"sref">out va>->6a hr9f="+c95currudr_finla href="+code=ipcp" cla64d>aroc_ita= 6  href="ipc/utilvaroc_ita=a hre class="sref">flita= 6  href="ipc/utta=a hr        6a href="+code=9u2" id  L9"sref">out va>->6a hr9f="+c95code=.95a>(6a href="+code=ipcp" clas>.6usmL5l;e.6956/a> = (6a href="+code=flag"ita= 6  href="ipc/utta=a hree=cont"5sass="srekmallola h6a href="+cokmalloll.c#L izeof=_perm" class="srita= 6  href="ipc/utta=a hr)idL658" class="liGFP_KERNEline" nam
  L592GFP_KERNEl_dla>        6a href="+code=9u5" id  L9a href="ipc/util.c#L655"9id  L9>(6a href="+coclas!perm" class="srita= 6  href="ipc/utta=a hr)       6a href="+code=9u5    @fl94_perm_to_ipc_perm  -   9   co95"line" nam
  L586">.5goinee=flag" class=">   6  href="ipc/uouc_dla        6a href="+code=9*t" class9.new style IPC permissio9s6/sp95 va>        if (6a href="+c9      @ou9: old style IPC permissi9ns6/s95container_of6code=ipcp" clas>.6usmL5l;eoseqoopaa3"6class="line"seqoopaal.c#L="sref">cgid6/ade>6a href="+codde&gflag,=csmL5lass="sref">ipcsysv="+caroc_ eqip"a h6a href="+cosysv="+caroc_ eqip"flag>        6a href="+code=9ut" class9 href="ipc/util.c#L659" 9d  L695ipce alloI   class="sref">ipcp v>.6usmL5l;e >>= 3;goinee=flag" class=">  _kfregt;6a href="+cod>  _kfreg_dla        6a href="+code=9      Fre9ct @in the6store ito a s9rnel:96f="ipseq6/a> seqt;6a href="+codseq_dlade= class="sref">ode>6a href="+codde&gflag=ipc_lelass="sref">iprivata_data>, struct.6a hrprivata_data_dla        6a href="+code=9 3" id  L963"6class="line" nam
  L963"6.96a>(6a href="+code=ipcp" classeqt;6a href="+codseq_dla=ipc_lelass="sref">iprivata>, struct.6a hrprivata92 6de=cont"5sass="srefta= 6  href="ipc/utta=a hr        6a href="+code=9 6/spalue9ipc_perm  - ass="sref">i9c64_p96 6a>    ct.6a href="+code=k9 6/spalue965"6class="line" nam
  L965"6.96(6a href="+code=ptr" class="ata= 6  href="ipc/utta=a hr=ipc_lelass="sref">ipf va>, struct.6a href vaflagde=cont"5sass="srePDE>, struct.6a hrPDEclass="sref">cgid6/a=noine" nam
  L571"6inoinflag)=ipc_lelass="sref">idata>, struct.6a hrdata_dla        6a href="+code=9 5    @fl9"sref">out va>->6a hr9f="+c96"line" nam
  C_OWNER" class=_ta= 6  href="ipc/utta=a hr=ipc_lelass="sref">is6/a>, 6a href="+code=Cm
  e=cont"5sass="srege/util.s6/a>, 6a href="+ge/util.s6class="sref">cgid6/am
  L61/a>, 6a href="+m
  L61a hr=ipc_lelass="sref">is6aroxy/a>, 6a href="+coaroxya hr=ipc_lelass="sref">ipil.s6/a>, 6a href="+til.s6clas>        6a href="+code=9 t" class9ass="sref">key SET_UID(69 href9"+codee=flag" class=">   6  href="ipc/uouc_dla:       6a href="+code=9      @ou9ass="sref">key SET_GID(69 href96container_of6>.6246/6id  L592"6clas>.6usmL5l;ekey SET_UID(69 href96 68> e=flag" class=">  _kfregt;6a href="+cod>  _kfreg_dla:       6a href="+code=9 t" class9ass="sref">key SET_GID(69 href969line" nam
  C_OWNER" class=kfregt;6a href="+codkfreg_dlass="sref">ipcp vata= 6  href="ipc/utta=a hr)        6a href="+code=9ut" class9"sref">out va>->6a hr9f="+c97currudr_finlagoinee=flag" class=">   6  href="ipc/uouc_dla        6a href="+code=9ut" class9"sref">out va>->6a hr9f="+c9de=seqevoid 6a href="+code=ker94"6id  L594"6class="line" nam
  L594"6.597ss="l haticr+code=ipc_nam
spacesysv="+caroc_>.leas a h6a href="+cosysv="+caroc_>.leas l.c#L href="+code=ipcp" clainoine" nam
  L571"6inoinflag" class="sref">flanoine" nam
  L571"6inoinflagcode=out" class="sref">ode>6a href="+codde&gflag" class="sref">flde>6a href="+codde&gflag>       6a href="+code=946/spalue9a href="ipc/util.c#L655"9id  L976/a>6                if (ref9 - du4_pm9ock   Lock laspermcture 9nd  t97e=key" class= href="+code=ipcp" claseqode>6a href="+codseqode&gflag" class="sref">flseqt;6a href="+codseq_dlade= class="sref">ode>6a href="+codde&gflag=ipc_lelass="sref">iprivata_data>, struct.6a hrprivata_data_dla        6a href="+code=9 t" class9 nam
id> *ifitrucspalue<9 href97"+code=ipcp"  href="+code=ipcp" cla64d>aroc_ita= 6  href="ipc/utilvaroc_ita=a hre class="sref">flita= 6  href="ipc/utta=a hree=cont"5sass="sreseqt;6a href="+codseq_dla=ipc_lelass="sref">iprivata>, struct.6a hrprivata92 6        6a href="+code=9      @ou9rcu L5old6look retalue, 6a href="+pu/util.s6_dlass="sref">ipcp vata= 6  href="ipc/utta=a hr=ipc_lelass="sref">is6/a>, 6a href="+code=C)        6a href="+code=9u/spalue<9 href="ipc/util.c#L599"69d  L6978ontainer_of6>.6246/6id  L592"6classeqo>.leas _privata>, struct.6a hrseqo>.leas _privataclass="sref">cgid6/a=noine" nam
  L571"6inoinflagidL658" class="lide>6a href="+codde&gflag>        6a href="+code=9ut" class9ret lasp bh, rnelrcu L5s9L5r t9/a>(&aeode&goopa=ahrefst;6a href="+codde&goopa=ahrefscode=e=ipc_nam
spacesysv="+caroc_fip"a h6a href="+cosysv="+caroc_fip"flagde=                if (ref9 3" id  L9a href="ipc/util.c#L641"9id  L98 href="ipc/ut.e=ipc_nam
spaceopaa3"6class="line"opaal.c#m
  e=cont"5sass="sresysv="+caroc_opaa3"6class="line"sysv="+caroc_opaal.c#6. LusmL5l;e. Ll.c#6kern_ipc9perm 984s="line" nam.e=ipc_nam
spacellsee83"6class="line"llsee8l.c# ee=cont"5sass="sreseqolsee83"6class="line"seqolsee8l.c#6.leas a h6a href="+cosysv="+caroc_>.leas l.c#69ern_i98data }        6a href="+code=94     @ou9ass="sref">ipc_la> = 6a 9ref="98conta#endsf  "line" nam
  L610">.610 3ONFIG_PROC_FS64583 68>e(&


L572original LXR software5byi+coda href="ihttp://source Lge.net/projects/lx= >LXR L61unityflagid+cis expa=i10">a ver" na5byia href="imailto:lx=@ineux.noe"lx=@ineux.noflag.
lx=.ineux.no kindly host L5byia href="ihttp://www.redpill-inepro.noe"Redpill Lnepro ASflagidprovider3of Lneuxrconsultss=" Lmopa=ahrefs services since 1995.