Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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