~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/ipc/compat.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * 32 bit compatibility code for System V IPC
  4  *
  5  * Copyright (C) 1997,1998      Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  6  * Copyright (C) 1997           David S. Miller (davem@caip.rutgers.edu)
  7  * Copyright (C) 1999           Arun Sharma <arun.sharma@intel.com>
  8  * Copyright (C) 2000           VA Linux Co
  9  * Copyright (C) 2000           Don Dugger <n0ano@valinux.com>
 10  * Copyright (C) 2000           Hewlett-Packard Co.
 11  * Copyright (C) 2000           David Mosberger-Tang <davidm@hpl.hp.com>
 12  * Copyright (C) 2000           Gerhard Tonn (ton@de.ibm.com)
 13  * Copyright (C) 2000-2002      Andi Kleen, SuSE Labs (x86-64 port)
 14  * Copyright (C) 2000           Silicon Graphics, Inc.
 15  * Copyright (C) 2001           IBM
 16  * Copyright (C) 2004           IBM Deutschland Entwicklung GmbH, IBM Corporation
 17  * Copyright (C) 2004           Arnd Bergmann (arnd@arndb.de)
 18  *
 19  * This code is collected from the versions for sparc64, mips64, s390x, ia64,
 20  * ppc64 and x86_64, all of which are based on the original sparc64 version
 21  * by Jakub Jelinek.
 22  *
 23  */
 24 #include <linux/compat.h>
 25 #include <linux/errno.h>
 26 #include <linux/highuid.h>
 27 #include <linux/init.h>
 28 #include <linux/msg.h>
 29 #include <linux/shm.h>
 30 #include <linux/syscalls.h>
 31 #include <linux/ptrace.h>
 32 
 33 #include <linux/mutex.h>
 34 #include <linux/uaccess.h>
 35 
 36 #include "util.h"
 37 
 38 int get_compat_ipc64_perm(struct ipc64_perm *to,
 39                           struct compat_ipc64_perm __user *from)
 40 {
 41         struct compat_ipc64_perm v;
 42         if (copy_from_user(&v, from, sizeof(v)))
 43                 return -EFAULT;
 44         to->uid = v.uid;
 45         to->gid = v.gid;
 46         to->mode = v.mode;
 47         return 0;
 48 }
 49 
 50 int get_compat_ipc_perm(struct ipc64_perm *to,
 51                         struct compat_ipc_perm __user *from)
 52 {
 53         struct compat_ipc_perm v;
 54         if (copy_from_user(&v, from, sizeof(v)))
 55                 return -EFAULT;
 56         to->uid = v.uid;
 57         to->gid = v.gid;
 58         to->mode = v.mode;
 59         return 0;
 60 }
 61 
 62 void to_compat_ipc64_perm(struct compat_ipc64_perm *to, struct ipc64_perm *from)
 63 {
 64         to->key = from->key;
 65         to->uid = from->uid;
 66         to->gid = from->gid;
 67         to->cuid = from->cuid;
 68         to->cgid = from->cgid;
 69         to->mode = from->mode;
 70         to->seq = from->seq;
 71 }
 72 
 73 void to_compat_ipc_perm(struct compat_ipc_perm *to, struct ipc64_perm *from)
 74 {
 75         to->key = from->key;
 76         SET_UID(to->uid, from->uid);
 77         SET_GID(to->gid, from->gid);
 78         SET_UID(to->cuid, from->cuid);
 79         SET_GID(to->cgid, from->cgid);
 80         to->mode = from->mode;
 81         to->seq = from->seq;
 82 }
 83 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php