powerpc: Remove direct call to mmap2 syscall handlers
Syscall handlers should not be invoked internally by their symbol names, as these symbols defined by the architecture-defined SYSCALL_DEFINE macro. Move the compatibility syscall definition for mmap2 to syscalls.c, so that all mmap implementations can share a helper function. Remove 'inline' on static mmap helper. Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Nicholas Piggin <npiggin@gmail.com> [mpe: Fix compat_sys_mmap2() prototype and offset handling] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220921065605.1051927-14-rmclure@linux.ibm.com
This commit is contained in:
parent
4df0221f9d
commit
b7fa9ce86d
|
@ -34,7 +34,7 @@ long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low,
|
||||||
u32 len_high, u32 len_low);
|
u32 len_high, u32 len_low);
|
||||||
|
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
|
long compat_sys_mmap2(unsigned long addr, size_t len,
|
||||||
unsigned long prot, unsigned long flags,
|
unsigned long prot, unsigned long flags,
|
||||||
unsigned long fd, unsigned long pgoff);
|
unsigned long fd, unsigned long pgoff);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
#include <linux/personality.h>
|
#include <linux/personality.h>
|
||||||
#include <linux/stat.h>
|
#include <linux/stat.h>
|
||||||
#include <linux/mman.h>
|
|
||||||
#include <linux/in.h>
|
#include <linux/in.h>
|
||||||
#include <linux/syscalls.h>
|
#include <linux/syscalls.h>
|
||||||
#include <linux/unistd.h>
|
#include <linux/unistd.h>
|
||||||
|
@ -48,14 +47,6 @@
|
||||||
#include <asm/syscalls.h>
|
#include <asm/syscalls.h>
|
||||||
#include <asm/switch_to.h>
|
#include <asm/switch_to.h>
|
||||||
|
|
||||||
unsigned long compat_sys_mmap2(unsigned long addr, size_t len,
|
|
||||||
unsigned long prot, unsigned long flags,
|
|
||||||
unsigned long fd, unsigned long pgoff)
|
|
||||||
{
|
|
||||||
/* This should remain 12 even if PAGE_SIZE changes */
|
|
||||||
return sys_mmap(addr, len, prot, flags, fd, pgoff << 12);
|
|
||||||
}
|
|
||||||
|
|
||||||
compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count,
|
compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count,
|
||||||
u32 reg6, u32 pos1, u32 pos2)
|
u32 reg6, u32 pos1, u32 pos2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,9 +36,9 @@
|
||||||
#include <asm/time.h>
|
#include <asm/time.h>
|
||||||
#include <asm/unistd.h>
|
#include <asm/unistd.h>
|
||||||
|
|
||||||
static inline long do_mmap2(unsigned long addr, size_t len,
|
static long do_mmap2(unsigned long addr, size_t len,
|
||||||
unsigned long prot, unsigned long flags,
|
unsigned long prot, unsigned long flags,
|
||||||
unsigned long fd, unsigned long off, int shift)
|
unsigned long fd, unsigned long off, int shift)
|
||||||
{
|
{
|
||||||
if (!arch_validate_prot(prot, addr))
|
if (!arch_validate_prot(prot, addr))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -56,6 +56,16 @@ SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
|
||||||
return do_mmap2(addr, len, prot, flags, fd, pgoff, PAGE_SHIFT-12);
|
return do_mmap2(addr, len, prot, flags, fd, pgoff, PAGE_SHIFT-12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_COMPAT
|
||||||
|
COMPAT_SYSCALL_DEFINE6(mmap2,
|
||||||
|
unsigned long, addr, size_t, len,
|
||||||
|
unsigned long, prot, unsigned long, flags,
|
||||||
|
unsigned long, fd, unsigned long, off_4k)
|
||||||
|
{
|
||||||
|
return do_mmap2(addr, len, prot, flags, fd, off_4k, PAGE_SHIFT-12);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len,
|
SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len,
|
||||||
unsigned long, prot, unsigned long, flags,
|
unsigned long, prot, unsigned long, flags,
|
||||||
unsigned long, fd, off_t, offset)
|
unsigned long, fd, off_t, offset)
|
||||||
|
|
Loading…
Reference in New Issue