* [PATCH v2 03/14] powerpc: Remove direct call to mmap2 syscall handlers
@ 2022-07-25 6:25 Rohan McLure
2022-08-08 3:24 ` Andrew Donnellan
2022-08-08 9:43 ` Christophe Leroy
0 siblings, 2 replies; 3+ messages in thread
From: Rohan McLure @ 2022-07-25 6:25 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Rohan McLure, npiggin
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 an inline helper
function, as is done with the personality handlers.
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
---
V1 -> V2: Move mmap2 compat implementation to asm/kernel/syscalls.c.
---
arch/powerpc/kernel/sys_ppc32.c | 10 ----------
arch/powerpc/kernel/syscalls.c | 11 +++++++++++
arch/powerpc/kernel/syscalls/syscall.tbl | 2 +-
tools/perf/arch/powerpc/entry/syscalls/syscall.tbl | 4 ++--
4 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index c3490adcb158..89e8c478fd6a 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -25,7 +25,6 @@
#include <linux/poll.h>
#include <linux/personality.h>
#include <linux/stat.h>
-#include <linux/mman.h>
#include <linux/in.h>
#include <linux/syscalls.h>
#include <linux/unistd.h>
@@ -48,15 +47,6 @@
#include <asm/syscalls.h>
#include <asm/switch_to.h>
-COMPAT_SYSCALL_DEFINE6(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);
-}
-
/*
* long long munging:
* The 32 bit ABI passes long longs in an odd even register pair.
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 22755502afc0..9f339bcb433d 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -56,6 +56,17 @@ SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
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, pgoff)
+{
+ /* This should remain 12 even if PAGE_SIZE changes */
+ return do_mmap2(addr, len, prot, flags, fd, pgoff << 12, PAGE_SHIFT-12);
+}
+#endif
+
SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len,
unsigned long, prot, unsigned long, flags,
unsigned long, fd, off_t, offset)
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index 54bb5834785f..59d9259dfbb5 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -243,7 +243,7 @@
189 nospu vfork sys_vfork
190 common ugetrlimit sys_getrlimit compat_sys_getrlimit
191 common readahead sys_readahead compat_sys_ppc_readahead
-192 32 mmap2 sys_mmap2 compat_sys_ppc_mmap2
+192 32 mmap2 sys_mmap2 compat_sys_mmap2
193 32 truncate64 sys_truncate64 compat_sys_ppc_truncate64
194 32 ftruncate64 sys_ftruncate64 compat_sys_ppc_ftruncate64
195 32 stat64 sys_stat64
diff --git a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
index 54bb5834785f..437066f5c4b2 100644
--- a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
+++ b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
@@ -243,7 +243,7 @@
189 nospu vfork sys_vfork
190 common ugetrlimit sys_getrlimit compat_sys_getrlimit
191 common readahead sys_readahead compat_sys_ppc_readahead
-192 32 mmap2 sys_mmap2 compat_sys_ppc_mmap2
+192 32 mmap2 sys_mmap2 compat_sys_mmap2
193 32 truncate64 sys_truncate64 compat_sys_ppc_truncate64
194 32 ftruncate64 sys_ftruncate64 compat_sys_ppc_ftruncate64
195 32 stat64 sys_stat64
@@ -391,7 +391,7 @@
306 common timerfd_create sys_timerfd_create
307 common eventfd sys_eventfd
308 common sync_file_range2 sys_sync_file_range2 compat_sys_ppc_sync_file_range2
-309 nospu fallocate sys_fallocate compat_sys_ppc_fallocate
+309 nospu fallocate sys_fallocate compat_sys_fallocate
310 nospu subpage_prot sys_subpage_prot
311 32 timerfd_settime sys_timerfd_settime32
311 64 timerfd_settime sys_timerfd_settime
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 03/14] powerpc: Remove direct call to mmap2 syscall handlers
2022-07-25 6:25 [PATCH v2 03/14] powerpc: Remove direct call to mmap2 syscall handlers Rohan McLure
@ 2022-08-08 3:24 ` Andrew Donnellan
2022-08-08 9:43 ` Christophe Leroy
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Donnellan @ 2022-08-08 3:24 UTC (permalink / raw)
To: Rohan McLure, linuxppc-dev; +Cc: npiggin
On Mon, 2022-07-25 at 16:25 +1000, Rohan McLure wrote:
>
> diff --git a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
> b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
> index 54bb5834785f..437066f5c4b2 100644
> --- a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
> +++ b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
> @@ -243,7 +243,7 @@
> 189 nospu vfork sys_vfork
> 190 common ugetrlimit sys_getrlimit
> compat_sys_getrlimit
> 191 common readahead sys_readahead
> compat_sys_ppc_readahead
> -
> 192 32 mmap2 sys_mmap2
> compat_sys_ppc_mmap2
> +192 32 mmap2 sys_mmap2
> compat_sys_mmap2
> 193 32 truncate64 sys_truncate64
> compat_sys_ppc_truncate64
> 194 32 ftruncate64 sys_ftruncate64
> compat_sys_ppc_ftruncate64
> 195 32 stat64 sys_stat64
> @@ -391,7 +391,7 @@
> 306 common timerfd_create sys_timerfd_create
> 307 common eventfd sys_eventfd
> 308 common sync_file_range2 sys_sync_file_range2
> compat_sys_ppc_sync_file_range2
> -
> 309 nospu fallocate sys_fallocate
> compat_sys_ppc_fallocate
> +309 nospu fallocate sys_fallocate
> compat_sys_fallocate
This should be in patch 5?
> 310 nospu subpage_prot sys_subpage_prot
> 311 32 timerfd_settime sys_timerfd_settime32
> 311 64 timerfd_settime sys_timerfd_settime
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 03/14] powerpc: Remove direct call to mmap2 syscall handlers
2022-07-25 6:25 [PATCH v2 03/14] powerpc: Remove direct call to mmap2 syscall handlers Rohan McLure
2022-08-08 3:24 ` Andrew Donnellan
@ 2022-08-08 9:43 ` Christophe Leroy
1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2022-08-08 9:43 UTC (permalink / raw)
To: Rohan McLure, linuxppc-dev@lists.ozlabs.org; +Cc: npiggin@gmail.com
Le 25/07/2022 à 08:25, Rohan McLure a écrit :
> 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 an inline helper
> function, as is done with the personality handlers.
>
> Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
> ---
> V1 -> V2: Move mmap2 compat implementation to asm/kernel/syscalls.c.
> ---
> arch/powerpc/kernel/sys_ppc32.c | 10 ----------
> arch/powerpc/kernel/syscalls.c | 11 +++++++++++
> arch/powerpc/kernel/syscalls/syscall.tbl | 2 +-
> tools/perf/arch/powerpc/entry/syscalls/syscall.tbl | 4 ++--
> 4 files changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
> index c3490adcb158..89e8c478fd6a 100644
> --- a/arch/powerpc/kernel/sys_ppc32.c
> +++ b/arch/powerpc/kernel/sys_ppc32.c
> @@ -25,7 +25,6 @@
> #include <linux/poll.h>
> #include <linux/personality.h>
> #include <linux/stat.h>
> -#include <linux/mman.h>
> #include <linux/in.h>
> #include <linux/syscalls.h>
> #include <linux/unistd.h>
> @@ -48,15 +47,6 @@
> #include <asm/syscalls.h>
> #include <asm/switch_to.h>
>
> -COMPAT_SYSCALL_DEFINE6(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);
> -}
> -
> /*
> * long long munging:
> * The 32 bit ABI passes long longs in an odd even register pair.
> diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
> index 22755502afc0..9f339bcb433d 100644
> --- a/arch/powerpc/kernel/syscalls.c
> +++ b/arch/powerpc/kernel/syscalls.c
> @@ -56,6 +56,17 @@ SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
> 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, pgoff)
> +{
> + /* This should remain 12 even if PAGE_SIZE changes */
> + return do_mmap2(addr, len, prot, flags, fd, pgoff << 12, PAGE_SHIFT-12);
> +}
> +#endif
> +
> SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len,
> unsigned long, prot, unsigned long, flags,
> unsigned long, fd, off_t, offset)
> diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
> index 54bb5834785f..59d9259dfbb5 100644
> --- a/arch/powerpc/kernel/syscalls/syscall.tbl
> +++ b/arch/powerpc/kernel/syscalls/syscall.tbl
> @@ -243,7 +243,7 @@
> 189 nospu vfork sys_vfork
> 190 common ugetrlimit sys_getrlimit compat_sys_getrlimit
> 191 common readahead sys_readahead compat_sys_ppc_readahead
> -192 32 mmap2 sys_mmap2 compat_sys_ppc_mmap2
> +192 32 mmap2 sys_mmap2 compat_sys_mmap2
Why a name change here when the function is just move from one C file to
another without any name change ?
This look like the reverse of what was done in patch 1. Could that
change go up front so that patch 1 doesn't need a change at all in the
table ?
> 193 32 truncate64 sys_truncate64 compat_sys_ppc_truncate64
> 194 32 ftruncate64 sys_ftruncate64 compat_sys_ppc_ftruncate64
> 195 32 stat64 sys_stat64
> diff --git a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
> index 54bb5834785f..437066f5c4b2 100644
> --- a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
> +++ b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
> @@ -243,7 +243,7 @@
> 189 nospu vfork sys_vfork
> 190 common ugetrlimit sys_getrlimit compat_sys_getrlimit
> 191 common readahead sys_readahead compat_sys_ppc_readahead
> -192 32 mmap2 sys_mmap2 compat_sys_ppc_mmap2
> +192 32 mmap2 sys_mmap2 compat_sys_mmap2
> 193 32 truncate64 sys_truncate64 compat_sys_ppc_truncate64
> 194 32 ftruncate64 sys_ftruncate64 compat_sys_ppc_ftruncate64
> 195 32 stat64 sys_stat64
> @@ -391,7 +391,7 @@
> 306 common timerfd_create sys_timerfd_create
> 307 common eventfd sys_eventfd
> 308 common sync_file_range2 sys_sync_file_range2 compat_sys_ppc_sync_file_range2
> -309 nospu fallocate sys_fallocate compat_sys_ppc_fallocate
> +309 nospu fallocate sys_fallocate compat_sys_fallocate
Why this name change ?
> 310 nospu subpage_prot sys_subpage_prot
> 311 32 timerfd_settime sys_timerfd_settime32
> 311 64 timerfd_settime sys_timerfd_settime
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-08 9:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-25 6:25 [PATCH v2 03/14] powerpc: Remove direct call to mmap2 syscall handlers Rohan McLure
2022-08-08 3:24 ` Andrew Donnellan
2022-08-08 9:43 ` Christophe Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).