License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2010-03-11 07:21:18 +08:00
|
|
|
/*
|
|
|
|
* sys_ipc() is the old de-multiplexer for the SysV IPC calls.
|
|
|
|
*
|
|
|
|
* This is really horribly ugly, and new architectures should just wire up
|
|
|
|
* the individual syscalls instead.
|
|
|
|
*/
|
|
|
|
#include <linux/unistd.h>
|
2017-07-09 22:27:22 +08:00
|
|
|
#include <linux/syscalls.h>
|
2018-03-21 02:48:14 +08:00
|
|
|
#include <linux/security.h>
|
|
|
|
#include <linux/ipc_namespace.h>
|
|
|
|
#include "util.h"
|
2010-03-11 07:21:18 +08:00
|
|
|
|
|
|
|
#ifdef __ARCH_WANT_SYS_IPC
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/ipc.h>
|
|
|
|
#include <linux/shm.h>
|
|
|
|
#include <linux/uaccess.h>
|
|
|
|
|
2019-01-16 21:15:20 +08:00
|
|
|
int ksys_ipc(unsigned int call, int first, unsigned long second,
|
|
|
|
unsigned long third, void __user * ptr, long fifth)
|
2010-03-11 07:21:18 +08:00
|
|
|
{
|
|
|
|
int version, ret;
|
|
|
|
|
|
|
|
version = call >> 16; /* hack for backward compatibility */
|
|
|
|
call &= 0xffff;
|
|
|
|
|
|
|
|
switch (call) {
|
|
|
|
case SEMOP:
|
2018-03-21 02:48:14 +08:00
|
|
|
return ksys_semtimedop(first, (struct sembuf __user *)ptr,
|
|
|
|
second, NULL);
|
2010-03-11 07:21:18 +08:00
|
|
|
case SEMTIMEDOP:
|
2019-04-23 23:43:50 +08:00
|
|
|
if (IS_ENABLED(CONFIG_64BIT))
|
2018-04-13 23:03:29 +08:00
|
|
|
return ksys_semtimedop(first, ptr, second,
|
|
|
|
(const struct __kernel_timespec __user *)fifth);
|
|
|
|
else if (IS_ENABLED(CONFIG_COMPAT_32BIT_TIME))
|
|
|
|
return compat_ksys_semtimedop(first, ptr, second,
|
y2038: globally rename compat_time to old_time32
Christoph Hellwig suggested a slightly different path for handling
backwards compatibility with the 32-bit time_t based system calls:
Rather than simply reusing the compat_sys_* entry points on 32-bit
architectures unchanged, we get rid of those entry points and the
compat_time types by renaming them to something that makes more sense
on 32-bit architectures (which don't have a compat mode otherwise),
and then share the entry points under the new name with the 64-bit
architectures that use them for implementing the compatibility.
The following types and interfaces are renamed here, and moved
from linux/compat_time.h to linux/time32.h:
old new
--- ---
compat_time_t old_time32_t
struct compat_timeval struct old_timeval32
struct compat_timespec struct old_timespec32
struct compat_itimerspec struct old_itimerspec32
ns_to_compat_timeval() ns_to_old_timeval32()
get_compat_itimerspec64() get_old_itimerspec32()
put_compat_itimerspec64() put_old_itimerspec32()
compat_get_timespec64() get_old_timespec32()
compat_put_timespec64() put_old_timespec32()
As we already have aliases in place, this patch addresses only the
instances that are relevant to the system call interface in particular,
not those that occur in device drivers and other modules. Those
will get handled separately, while providing the 64-bit version
of the respective interfaces.
I'm not renaming the timex, rusage and itimerval structures, as we are
still debating what the new interface will look like, and whether we
will need a replacement at all.
This also doesn't change the names of the syscall entry points, which can
be done more easily when we actually switch over the 32-bit architectures
to use them, at that point we need to change COMPAT_SYSCALL_DEFINEx to
SYSCALL_DEFINEx with a new name, e.g. with a _time32 suffix.
Suggested-by: Christoph Hellwig <hch@infradead.org>
Link: https://lore.kernel.org/lkml/20180705222110.GA5698@infradead.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-07-13 18:52:28 +08:00
|
|
|
(const struct old_timespec32 __user *)fifth);
|
2018-04-13 23:03:29 +08:00
|
|
|
else
|
|
|
|
return -ENOSYS;
|
2010-03-11 07:21:18 +08:00
|
|
|
|
|
|
|
case SEMGET:
|
2018-03-21 02:53:58 +08:00
|
|
|
return ksys_semget(first, second, third);
|
2010-03-11 07:21:18 +08:00
|
|
|
case SEMCTL: {
|
2013-03-06 04:04:55 +08:00
|
|
|
unsigned long arg;
|
2010-03-11 07:21:18 +08:00
|
|
|
if (!ptr)
|
|
|
|
return -EINVAL;
|
2013-03-06 04:04:55 +08:00
|
|
|
if (get_user(arg, (unsigned long __user *) ptr))
|
2010-03-11 07:21:18 +08:00
|
|
|
return -EFAULT;
|
ipc: rename old-style shmctl/semctl/msgctl syscalls
The behavior of these system calls is slightly different between
architectures, as determined by the CONFIG_ARCH_WANT_IPC_PARSE_VERSION
symbol. Most architectures that implement the split IPC syscalls don't set
that symbol and only get the modern version, but alpha, arm, microblaze,
mips-n32, mips-n64 and xtensa expect the caller to pass the IPC_64 flag.
For the architectures that so far only implement sys_ipc(), i.e. m68k,
mips-o32, powerpc, s390, sh, sparc, and x86-32, we want the new behavior
when adding the split syscalls, so we need to distinguish between the
two groups of architectures.
The method I picked for this distinction is to have a separate system call
entry point: sys_old_*ctl() now uses ipc_parse_version, while sys_*ctl()
does not. The system call tables of the five architectures are changed
accordingly.
As an additional benefit, we no longer need the configuration specific
definition for ipc_parse_version(), it always does the same thing now,
but simply won't get called on architectures with the modern interface.
A small downside is that on architectures that do set
ARCH_WANT_IPC_PARSE_VERSION, we now have an extra set of entry points
that are never called. They only add a few bytes of bloat, so it seems
better to keep them compared to adding yet another Kconfig symbol.
I considered adding new syscall numbers for the IPC_64 variants for
consistency, but decided against that for now.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2019-01-01 05:22:40 +08:00
|
|
|
return ksys_old_semctl(first, second, third, arg);
|
2010-03-11 07:21:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
case MSGSND:
|
2018-03-21 04:29:00 +08:00
|
|
|
return ksys_msgsnd(first, (struct msgbuf __user *) ptr,
|
2010-03-11 07:21:18 +08:00
|
|
|
second, third);
|
|
|
|
case MSGRCV:
|
|
|
|
switch (version) {
|
|
|
|
case 0: {
|
|
|
|
struct ipc_kludge tmp;
|
|
|
|
if (!ptr)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (copy_from_user(&tmp,
|
|
|
|
(struct ipc_kludge __user *) ptr,
|
|
|
|
sizeof(tmp)))
|
|
|
|
return -EFAULT;
|
2018-03-21 04:25:57 +08:00
|
|
|
return ksys_msgrcv(first, tmp.msgp, second,
|
2010-03-11 07:21:18 +08:00
|
|
|
tmp.msgtyp, third);
|
|
|
|
}
|
|
|
|
default:
|
2018-03-21 04:25:57 +08:00
|
|
|
return ksys_msgrcv(first,
|
2010-03-11 07:21:18 +08:00
|
|
|
(struct msgbuf __user *) ptr,
|
|
|
|
second, fifth, third);
|
|
|
|
}
|
|
|
|
case MSGGET:
|
2018-03-21 03:06:04 +08:00
|
|
|
return ksys_msgget((key_t) first, second);
|
2010-03-11 07:21:18 +08:00
|
|
|
case MSGCTL:
|
ipc: rename old-style shmctl/semctl/msgctl syscalls
The behavior of these system calls is slightly different between
architectures, as determined by the CONFIG_ARCH_WANT_IPC_PARSE_VERSION
symbol. Most architectures that implement the split IPC syscalls don't set
that symbol and only get the modern version, but alpha, arm, microblaze,
mips-n32, mips-n64 and xtensa expect the caller to pass the IPC_64 flag.
For the architectures that so far only implement sys_ipc(), i.e. m68k,
mips-o32, powerpc, s390, sh, sparc, and x86-32, we want the new behavior
when adding the split syscalls, so we need to distinguish between the
two groups of architectures.
The method I picked for this distinction is to have a separate system call
entry point: sys_old_*ctl() now uses ipc_parse_version, while sys_*ctl()
does not. The system call tables of the five architectures are changed
accordingly.
As an additional benefit, we no longer need the configuration specific
definition for ipc_parse_version(), it always does the same thing now,
but simply won't get called on architectures with the modern interface.
A small downside is that on architectures that do set
ARCH_WANT_IPC_PARSE_VERSION, we now have an extra set of entry points
that are never called. They only add a few bytes of bloat, so it seems
better to keep them compared to adding yet another Kconfig symbol.
I considered adding new syscall numbers for the IPC_64 variants for
consistency, but decided against that for now.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2019-01-01 05:22:40 +08:00
|
|
|
return ksys_old_msgctl(first, second,
|
2018-03-21 03:15:28 +08:00
|
|
|
(struct msqid_ds __user *)ptr);
|
2010-03-11 07:21:18 +08:00
|
|
|
|
|
|
|
case SHMAT:
|
|
|
|
switch (version) {
|
|
|
|
default: {
|
|
|
|
unsigned long raddr;
|
|
|
|
ret = do_shmat(first, (char __user *)ptr,
|
2012-07-31 05:42:38 +08:00
|
|
|
second, &raddr, SHMLBA);
|
2010-03-11 07:21:18 +08:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
return put_user(raddr, (unsigned long __user *) third);
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
/*
|
|
|
|
* This was the entry point for kernel-originating calls
|
|
|
|
* from iBCS2 in 2.2 days.
|
|
|
|
*/
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
case SHMDT:
|
2018-03-21 03:09:48 +08:00
|
|
|
return ksys_shmdt((char __user *)ptr);
|
2010-03-11 07:21:18 +08:00
|
|
|
case SHMGET:
|
2018-03-21 03:07:53 +08:00
|
|
|
return ksys_shmget(first, second, third);
|
2010-03-11 07:21:18 +08:00
|
|
|
case SHMCTL:
|
ipc: rename old-style shmctl/semctl/msgctl syscalls
The behavior of these system calls is slightly different between
architectures, as determined by the CONFIG_ARCH_WANT_IPC_PARSE_VERSION
symbol. Most architectures that implement the split IPC syscalls don't set
that symbol and only get the modern version, but alpha, arm, microblaze,
mips-n32, mips-n64 and xtensa expect the caller to pass the IPC_64 flag.
For the architectures that so far only implement sys_ipc(), i.e. m68k,
mips-o32, powerpc, s390, sh, sparc, and x86-32, we want the new behavior
when adding the split syscalls, so we need to distinguish between the
two groups of architectures.
The method I picked for this distinction is to have a separate system call
entry point: sys_old_*ctl() now uses ipc_parse_version, while sys_*ctl()
does not. The system call tables of the five architectures are changed
accordingly.
As an additional benefit, we no longer need the configuration specific
definition for ipc_parse_version(), it always does the same thing now,
but simply won't get called on architectures with the modern interface.
A small downside is that on architectures that do set
ARCH_WANT_IPC_PARSE_VERSION, we now have an extra set of entry points
that are never called. They only add a few bytes of bloat, so it seems
better to keep them compared to adding yet another Kconfig symbol.
I considered adding new syscall numbers for the IPC_64 variants for
consistency, but decided against that for now.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2019-01-01 05:22:40 +08:00
|
|
|
return ksys_old_shmctl(first, second,
|
2010-03-11 07:21:18 +08:00
|
|
|
(struct shmid_ds __user *) ptr);
|
|
|
|
default:
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
|
|
|
}
|
2019-01-16 21:15:20 +08:00
|
|
|
|
|
|
|
SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
|
|
|
|
unsigned long, third, void __user *, ptr, long, fifth)
|
|
|
|
{
|
|
|
|
return ksys_ipc(call, first, second, third, ptr, fifth);
|
|
|
|
}
|
2010-03-11 07:21:18 +08:00
|
|
|
#endif
|
2017-07-09 22:27:22 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_COMPAT
|
|
|
|
#include <linux/compat.h>
|
|
|
|
|
|
|
|
#ifndef COMPAT_SHMLBA
|
|
|
|
#define COMPAT_SHMLBA SHMLBA
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct compat_ipc_kludge {
|
|
|
|
compat_uptr_t msgp;
|
|
|
|
compat_long_t msgtyp;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
|
2019-01-16 21:15:20 +08:00
|
|
|
int compat_ksys_ipc(u32 call, int first, int second,
|
|
|
|
u32 third, compat_uptr_t ptr, u32 fifth)
|
2017-07-09 22:27:22 +08:00
|
|
|
{
|
|
|
|
int version;
|
|
|
|
u32 pad;
|
|
|
|
|
|
|
|
version = call >> 16; /* hack for backward compatibility */
|
|
|
|
call &= 0xffff;
|
|
|
|
|
|
|
|
switch (call) {
|
|
|
|
case SEMOP:
|
|
|
|
/* struct sembuf is the same on 32 and 64bit :)) */
|
2018-03-21 02:48:14 +08:00
|
|
|
return ksys_semtimedop(first, compat_ptr(ptr), second, NULL);
|
2017-07-09 22:27:22 +08:00
|
|
|
case SEMTIMEDOP:
|
2018-04-13 23:03:29 +08:00
|
|
|
if (!IS_ENABLED(CONFIG_COMPAT_32BIT_TIME))
|
|
|
|
return -ENOSYS;
|
2018-03-21 02:48:14 +08:00
|
|
|
return compat_ksys_semtimedop(first, compat_ptr(ptr), second,
|
2017-07-09 22:27:22 +08:00
|
|
|
compat_ptr(fifth));
|
|
|
|
case SEMGET:
|
2018-03-21 02:53:58 +08:00
|
|
|
return ksys_semget(first, second, third);
|
2017-07-09 22:27:22 +08:00
|
|
|
case SEMCTL:
|
|
|
|
if (!ptr)
|
|
|
|
return -EINVAL;
|
|
|
|
if (get_user(pad, (u32 __user *) compat_ptr(ptr)))
|
|
|
|
return -EFAULT;
|
ipc: rename old-style shmctl/semctl/msgctl syscalls
The behavior of these system calls is slightly different between
architectures, as determined by the CONFIG_ARCH_WANT_IPC_PARSE_VERSION
symbol. Most architectures that implement the split IPC syscalls don't set
that symbol and only get the modern version, but alpha, arm, microblaze,
mips-n32, mips-n64 and xtensa expect the caller to pass the IPC_64 flag.
For the architectures that so far only implement sys_ipc(), i.e. m68k,
mips-o32, powerpc, s390, sh, sparc, and x86-32, we want the new behavior
when adding the split syscalls, so we need to distinguish between the
two groups of architectures.
The method I picked for this distinction is to have a separate system call
entry point: sys_old_*ctl() now uses ipc_parse_version, while sys_*ctl()
does not. The system call tables of the five architectures are changed
accordingly.
As an additional benefit, we no longer need the configuration specific
definition for ipc_parse_version(), it always does the same thing now,
but simply won't get called on architectures with the modern interface.
A small downside is that on architectures that do set
ARCH_WANT_IPC_PARSE_VERSION, we now have an extra set of entry points
that are never called. They only add a few bytes of bloat, so it seems
better to keep them compared to adding yet another Kconfig symbol.
I considered adding new syscall numbers for the IPC_64 variants for
consistency, but decided against that for now.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2019-01-01 05:22:40 +08:00
|
|
|
return compat_ksys_old_semctl(first, second, third, pad);
|
2017-07-09 22:27:22 +08:00
|
|
|
|
|
|
|
case MSGSND:
|
2018-03-21 04:29:00 +08:00
|
|
|
return compat_ksys_msgsnd(first, ptr, second, third);
|
2017-07-09 22:27:22 +08:00
|
|
|
|
|
|
|
case MSGRCV: {
|
|
|
|
void __user *uptr = compat_ptr(ptr);
|
|
|
|
|
|
|
|
if (first < 0 || second < 0)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (!version) {
|
|
|
|
struct compat_ipc_kludge ipck;
|
|
|
|
if (!uptr)
|
|
|
|
return -EINVAL;
|
|
|
|
if (copy_from_user(&ipck, uptr, sizeof(ipck)))
|
|
|
|
return -EFAULT;
|
2018-03-21 04:25:57 +08:00
|
|
|
return compat_ksys_msgrcv(first, ipck.msgp, second,
|
2017-07-09 22:27:22 +08:00
|
|
|
ipck.msgtyp, third);
|
|
|
|
}
|
2018-03-21 04:25:57 +08:00
|
|
|
return compat_ksys_msgrcv(first, ptr, second, fifth, third);
|
2017-07-09 22:27:22 +08:00
|
|
|
}
|
|
|
|
case MSGGET:
|
2018-03-21 03:06:04 +08:00
|
|
|
return ksys_msgget(first, second);
|
2017-07-09 22:27:22 +08:00
|
|
|
case MSGCTL:
|
ipc: rename old-style shmctl/semctl/msgctl syscalls
The behavior of these system calls is slightly different between
architectures, as determined by the CONFIG_ARCH_WANT_IPC_PARSE_VERSION
symbol. Most architectures that implement the split IPC syscalls don't set
that symbol and only get the modern version, but alpha, arm, microblaze,
mips-n32, mips-n64 and xtensa expect the caller to pass the IPC_64 flag.
For the architectures that so far only implement sys_ipc(), i.e. m68k,
mips-o32, powerpc, s390, sh, sparc, and x86-32, we want the new behavior
when adding the split syscalls, so we need to distinguish between the
two groups of architectures.
The method I picked for this distinction is to have a separate system call
entry point: sys_old_*ctl() now uses ipc_parse_version, while sys_*ctl()
does not. The system call tables of the five architectures are changed
accordingly.
As an additional benefit, we no longer need the configuration specific
definition for ipc_parse_version(), it always does the same thing now,
but simply won't get called on architectures with the modern interface.
A small downside is that on architectures that do set
ARCH_WANT_IPC_PARSE_VERSION, we now have an extra set of entry points
that are never called. They only add a few bytes of bloat, so it seems
better to keep them compared to adding yet another Kconfig symbol.
I considered adding new syscall numbers for the IPC_64 variants for
consistency, but decided against that for now.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2019-01-01 05:22:40 +08:00
|
|
|
return compat_ksys_old_msgctl(first, second, compat_ptr(ptr));
|
2017-07-09 22:27:22 +08:00
|
|
|
|
|
|
|
case SHMAT: {
|
|
|
|
int err;
|
|
|
|
unsigned long raddr;
|
|
|
|
|
|
|
|
if (version == 1)
|
|
|
|
return -EINVAL;
|
|
|
|
err = do_shmat(first, compat_ptr(ptr), second, &raddr,
|
|
|
|
COMPAT_SHMLBA);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2017-09-26 09:37:28 +08:00
|
|
|
return put_user(raddr, (compat_ulong_t __user *)compat_ptr(third));
|
2017-07-09 22:27:22 +08:00
|
|
|
}
|
|
|
|
case SHMDT:
|
2018-03-21 03:09:48 +08:00
|
|
|
return ksys_shmdt(compat_ptr(ptr));
|
2017-07-09 22:27:22 +08:00
|
|
|
case SHMGET:
|
2018-03-21 03:07:53 +08:00
|
|
|
return ksys_shmget(first, (unsigned int)second, third);
|
2017-07-09 22:27:22 +08:00
|
|
|
case SHMCTL:
|
ipc: rename old-style shmctl/semctl/msgctl syscalls
The behavior of these system calls is slightly different between
architectures, as determined by the CONFIG_ARCH_WANT_IPC_PARSE_VERSION
symbol. Most architectures that implement the split IPC syscalls don't set
that symbol and only get the modern version, but alpha, arm, microblaze,
mips-n32, mips-n64 and xtensa expect the caller to pass the IPC_64 flag.
For the architectures that so far only implement sys_ipc(), i.e. m68k,
mips-o32, powerpc, s390, sh, sparc, and x86-32, we want the new behavior
when adding the split syscalls, so we need to distinguish between the
two groups of architectures.
The method I picked for this distinction is to have a separate system call
entry point: sys_old_*ctl() now uses ipc_parse_version, while sys_*ctl()
does not. The system call tables of the five architectures are changed
accordingly.
As an additional benefit, we no longer need the configuration specific
definition for ipc_parse_version(), it always does the same thing now,
but simply won't get called on architectures with the modern interface.
A small downside is that on architectures that do set
ARCH_WANT_IPC_PARSE_VERSION, we now have an extra set of entry points
that are never called. They only add a few bytes of bloat, so it seems
better to keep them compared to adding yet another Kconfig symbol.
I considered adding new syscall numbers for the IPC_64 variants for
consistency, but decided against that for now.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2019-01-01 05:22:40 +08:00
|
|
|
return compat_ksys_old_shmctl(first, second, compat_ptr(ptr));
|
2017-07-09 22:27:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
2019-01-16 21:15:20 +08:00
|
|
|
|
|
|
|
COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
|
|
|
|
u32, third, compat_uptr_t, ptr, u32, fifth)
|
|
|
|
{
|
|
|
|
return compat_ksys_ipc(call, first, second, third, ptr, fifth);
|
|
|
|
}
|
2017-07-09 22:27:22 +08:00
|
|
|
#endif
|
|
|
|
#endif
|