Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/viro/signal

Pull compat cleanup from Al Viro:
 "Mostly about syscall wrappers this time; there will be another pile
  with patches in the same general area from various people, but I'd
  rather push those after both that and vfs.git pile are in."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal:
  syscalls.h: slightly reduce the jungles of macros
  get rid of union semop in sys_semctl(2) arguments
  make do_mremap() static
  sparc: no need to sign-extend in sync_file_range() wrapper
  ppc compat wrappers for add_key(2) and request_key(2) are pointless
  x86: trim sys_ia32.h
  x86: sys32_kill and sys32_mprotect are pointless
  get rid of compat_sys_semctl() and friends in case of ARCH_WANT_OLD_COMPAT_IPC
  merge compat sys_ipc instances
  consolidate compat lookup_dcookie()
  convert vmsplice to COMPAT_SYSCALL_DEFINE
  switch getrusage() to COMPAT_SYSCALL_DEFINE
  switch epoll_pwait to COMPAT_SYSCALL_DEFINE
  convert sendfile{,64} to COMPAT_SYSCALL_DEFINE
  switch signalfd{,4}() to COMPAT_SYSCALL_DEFINE
  make SYSCALL_DEFINE<n>-generated wrappers do asmlinkage_protect
  make HAVE_SYSCALL_WRAPPERS unconditional
  consolidate cond_syscall and SYSCALL_ALIAS declarations
  teach SYSCALL_DEFINE<n> how to deal with long long/unsigned long long
  get rid of duplicate logics in __SC_....[1-6] definitions
  • Loading branch information
torvalds committed May 1, 2013
2 parents 5f56886 + 99e621f commit 08d7676
Show file tree
Hide file tree
Showing 87 changed files with 539 additions and 1,489 deletions.
3 changes: 0 additions & 3 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ config ARCH_USE_BUILTIN_BSWAP
instructions should set this. And it shouldn't hurt to set it
on architectures that don't have such instructions.

config HAVE_SYSCALL_WRAPPERS
bool

config KRETPROBES
def_bool y
depends on KPROBES && HAVE_KRETPROBES
Expand Down
1 change: 0 additions & 1 deletion arch/alpha/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ config ALPHA
select HAVE_AOUT
select HAVE_IDE
select HAVE_OPROFILE
select HAVE_SYSCALL_WRAPPERS
select HAVE_PCSPKR_PLATFORM
select HAVE_PERF_EVENTS
select HAVE_DMA_ATTRS
Expand Down
4 changes: 3 additions & 1 deletion arch/alpha/include/asm/linkage.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef __ASM_LINKAGE_H
#define __ASM_LINKAGE_H

/* Nothing to see here... */
#define cond_syscall(x) asm(".weak\t" #x "\n" #x " = sys_ni_syscall")
#define SYSCALL_ALIAS(alias, name) \
asm ( #alias " = " #name "\n\t.globl " #alias)

#endif
12 changes: 0 additions & 12 deletions arch/alpha/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/* "Conditional" syscalls. What we want is
__attribute__((weak,alias("sys_ni_syscall")))
but that raises the problem of what type to give the symbol. If we use
a prototype, it'll conflict with the definition given in this file and
others. If we use __typeof, we discover that not all symbols actually
have declarations. If we use no prototype, then we get warnings from
-Wstrict-prototypes. Ho hum. */

#define cond_syscall(x) asm(".weak\t" #x "\n" #x " = sys_ni_syscall")

#endif /* _ALPHA_UNISTD_H */
8 changes: 0 additions & 8 deletions arch/arm/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

/*
* Unimplemented (or alternatively implemented) syscalls
*/
Expand Down
7 changes: 0 additions & 7 deletions arch/arm64/kernel/sys32.S
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,6 @@ compat_sys_readahead_wrapper:
b sys_readahead
ENDPROC(compat_sys_readahead_wrapper)

compat_sys_lookup_dcookie:
orr x0, x0, x1, lsl #32
mov w1, w2
mov w2, w3
b sys_lookup_dcookie
ENDPROC(compat_sys_lookup_dcookie)

compat_sys_fadvise64_64_wrapper:
mov w6, w1
orr x1, x2, x3, lsl #32
Expand Down
8 changes: 0 additions & 8 deletions arch/avr32/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");

#endif /* __ASM_AVR32_UNISTD_H */
8 changes: 0 additions & 8 deletions arch/blackfin/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,4 @@
#define __ARCH_WANT_SYS_NICE
#define __ARCH_WANT_SYS_VFORK

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t_" #x "\n\t.set\t_" #x ",_sys_ni_syscall");

#endif /* __ASM_BFIN_UNISTD_H */
8 changes: 0 additions & 8 deletions arch/cris/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

#endif /* _ASM_CRIS_UNISTD_H_ */
10 changes: 0 additions & 10 deletions arch/frv/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#ifndef cond_syscall
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
#endif

#endif /* _ASM_UNISTD_H_ */
2 changes: 0 additions & 2 deletions arch/h8300/include/asm/linkage.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
#define _H8300_LINKAGE_H

#undef SYMBOL_NAME_LABEL
#undef SYMBOL_NAME
#define SYMBOL_NAME_LABEL(_name_) _##_name_##:
#define SYMBOL_NAME(_name_) _##_name_
#endif
7 changes: 0 additions & 7 deletions arch/h8300/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,4 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE

/*
* "Conditional" syscalls
*/
#define cond_syscall(name) \
asm (".weak\t_" #name "\n" \
".set\t_" #name ",_sys_ni_syscall");

#endif /* _ASM_H8300_UNISTD_H_ */
4 changes: 4 additions & 0 deletions arch/ia64/include/asm/linkage.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@

#endif

#define cond_syscall(x) asm(".weak\t" #x "#\n" #x "#\t=\tsys_ni_syscall#")
#define SYSCALL_ALIAS(alias, name) \
asm ( #alias "# = " #name "#\n\t.globl " #alias "#")

#endif
10 changes: 0 additions & 10 deletions arch/ia64/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,5 @@ asmlinkage unsigned long sys_mmap2(
struct pt_regs;
asmlinkage long sys_ia64_pipe(void);

/*
* "Conditional" syscalls
*
* Note, this macro can only be used in the file which defines sys_ni_syscall, i.e., in
* kernel/sys_ni.c. This version causes warnings because the declaration isn't a
* proper prototype, but we can't use __typeof__ either, because not all cond_syscall()
* declarations have prototypes at the moment.
*/
#define cond_syscall(x) asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))

#endif /* !__ASSEMBLY__ */
#endif /* _ASM_IA64_UNISTD_H */
10 changes: 0 additions & 10 deletions arch/m32r/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,4 @@
#define __IGNORE_getresgid
#define __IGNORE_chown

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#ifndef cond_syscall
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
#endif

#endif /* _ASM_M32R_UNISTD_H */
8 changes: 0 additions & 8 deletions arch/m68k/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,4 @@
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")

#endif /* _ASM_M68K_UNISTD_H_ */
8 changes: 0 additions & 8 deletions arch/microblaze/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,5 @@
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_FORK

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");

#endif /* __ASSEMBLY__ */
#endif /* _ASM_MICROBLAZE_UNISTD_H */
1 change: 0 additions & 1 deletion arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,6 @@ config 32BIT
config 64BIT
bool "64-bit kernel"
depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL
select HAVE_SYSCALL_WRAPPERS
help
Select this option if you want to build a 64-bit kernel.

Expand Down
3 changes: 3 additions & 0 deletions arch/mips/include/asm/linkage.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
#endif

#define __weak __attribute__((weak))
#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
#define SYSCALL_ALIAS(alias, name) \
asm ( #alias " = " #name "\n\t.globl " #alias)

#endif
8 changes: 0 additions & 8 deletions arch/mips/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,4 @@

#endif /* !__ASSEMBLY__ */

/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")

#endif /* _ASM_UNISTD_H */
119 changes: 0 additions & 119 deletions arch/mips/kernel/linux32.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,99 +119,6 @@ SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf,
return sys_pwrite64(fd, buf, count, merge_64(a4, a5));
}

#ifdef CONFIG_SYSVIPC

SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third,
unsigned long, ptr, unsigned long, fifth)
{
int version, err;

version = call >> 16; /* hack for backward compatibility */
call &= 0xffff;

switch (call) {
case SEMOP:
/* struct sembuf is the same on 32 and 64bit :)) */
err = sys_semtimedop(first, compat_ptr(ptr), second, NULL);
break;
case SEMTIMEDOP:
err = compat_sys_semtimedop(first, compat_ptr(ptr), second,
compat_ptr(fifth));
break;
case SEMGET:
err = sys_semget(first, second, third);
break;
case SEMCTL:
err = compat_sys_semctl(first, second, third, compat_ptr(ptr));
break;
case MSGSND:
err = compat_sys_msgsnd(first, second, third, compat_ptr(ptr));
break;
case MSGRCV:
err = compat_sys_msgrcv(first, second, fifth, third,
version, compat_ptr(ptr));
break;
case MSGGET:
err = sys_msgget((key_t) first, second);
break;
case MSGCTL:
err = compat_sys_msgctl(first, second, compat_ptr(ptr));
break;
case SHMAT:
err = compat_sys_shmat(first, second, third, version,
compat_ptr(ptr));
break;
case SHMDT:
err = sys_shmdt(compat_ptr(ptr));
break;
case SHMGET:
err = sys_shmget(first, (unsigned)second, third);
break;
case SHMCTL:
err = compat_sys_shmctl(first, second, compat_ptr(ptr));
break;
default:
err = -ENOSYS;
break;
}

return err;
}

#else

SYSCALL_DEFINE6(32_ipc, u32, call, int, first, int, second, int, third,
u32, ptr, u32, fifth)
{
return -ENOSYS;
}

#endif /* CONFIG_SYSVIPC */

#ifdef CONFIG_MIPS32_N32
SYSCALL_DEFINE4(n32_semctl, int, semid, int, semnum, int, cmd, u32, arg)
{
/* compat_sys_semctl expects a pointer to union semun */
u32 __user *uptr = compat_alloc_user_space(sizeof(u32));
if (put_user(arg, uptr))
return -EFAULT;
return compat_sys_semctl(semid, semnum, cmd, uptr);
}

SYSCALL_DEFINE4(n32_msgsnd, int, msqid, u32, msgp, unsigned int, msgsz,
int, msgflg)
{
return compat_sys_msgsnd(msqid, msgsz, msgflg, compat_ptr(msgp));
}

SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz,
int, msgtyp, int, msgflg)
{
return compat_sys_msgrcv(msqid, msgsz, msgtyp, msgflg, IPC_64,
compat_ptr(msgp));
}
#endif

SYSCALL_DEFINE1(32_personality, unsigned long, personality)
{
unsigned int p = personality & 0xffffffff;
Expand All @@ -226,26 +133,6 @@ SYSCALL_DEFINE1(32_personality, unsigned long, personality)
return ret;
}

SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd,
compat_off_t __user *, offset, s32, count)
{
mm_segment_t old_fs = get_fs();
int ret;
off_t of;

if (offset && get_user(of, offset))
return -EFAULT;

set_fs(KERNEL_DS);
ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count);
set_fs(old_fs);

if (offset && put_user(of, offset))
return -EFAULT;

return ret;
}

asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3,
size_t count)
{
Expand Down Expand Up @@ -279,12 +166,6 @@ asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2,
merge_64(len_a4, len_a5));
}

asmlinkage long sys32_lookup_dcookie(u32 a0, u32 a1, char __user *buf,
size_t len)
{
return sys_lookup_dcookie(merge_64(a0, a1), buf, len);
}

SYSCALL_DEFINE6(32_fanotify_mark, int, fanotify_fd, unsigned int, flags,
u64, a3, u64, a4, int, dfd, const char __user *, pathname)
{
Expand Down
Loading

0 comments on commit 08d7676

Please sign in to comment.