Hi Huacai,
The compat wrappers are needed for all of them for O32/N32 on a 64-bit
kernel. {get,set}mempolicy, mbind and migrate_pages all copy bitmaps
to/from user memory. The non-compat versions would behave fine on little
endian, but the compat versions are needed to convert the 32-bit bitmaps
to 64-bit on big endian.
move_pages takes an array of pointers, the compat version is needed to
convert that to 64-bit.
Alex
On 11/04/14 09:21, Huacai Chen wrote:
Hi, MIPS hackers,
Could anyone help me?
Huacai
On Thu, Apr 10, 2014 at 6:47 PM, Huacai Chen <chenhc@xxxxxxxxxx> wrote:
Hi, David,
After some code reading, I have some understanding about compat
syscall, please tell me whether I'm correct.
1, compat syscall is only needed by n32/o32 userspace on 64-bit kernel.
2, compat syscall is only needed when there are arguments in pointer type.
3, compat syscall is only needed when pointer arguments are
array/struct/union for reading (reading means get_user or
copy_from_user), or pointer arguments are array/struct/union/long
integer for writing (writing means put_user or copy_to_user).
If my understanding is correct, then in this patch, get_mempolicy()
need to use the compat version for n32/o32 on 64-bit kernel, mbind()
and set_mempolicy() can use the normal version in all cases. But when
I reading the X86 code, it seems like only o32 on 64-bit kernel need a
compat version (I assume i386/X32/X64 on X86 is the same as
o32/n32/n64 on MIPS).
Please give some information, thanks.
Huacai
On Sat, Apr 5, 2014 at 8:54 AM, "陈华才" <chenhc@xxxxxxxxxx> wrote:
Excuse me, what's the compat version exactly means? Or how to produce a
problem without a compat version? It seems everything works fine just
with this patch.
Huacai
On 04/04/2014 01:11 AM, Huacai Chen wrote:
Enable sys_mbind()/sys_get_mempolicy()/sys_set_mempolicy() for O32, N32,
and N64 ABIs.
Signed-off-by: Huacai Chen <chenhc@xxxxxxxxxx>
NACK.
You need compat versions of the syscalls...
Also current migrate_pages and move_pages syscalls need to use the
compat wrappers for 32-bit ABIs.
David Daney
---
arch/mips/kernel/scall32-o32.S | 4 ++--
arch/mips/kernel/scall64-64.S | 4 ++--
arch/mips/kernel/scall64-n32.S | 6 +++---
arch/mips/kernel/scall64-o32.S | 6 +++---
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/mips/kernel/scall32-o32.S
b/arch/mips/kernel/scall32-o32.S
index fdc70b4..7f7e2fb 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -495,8 +495,8 @@ EXPORT(sys_call_table)
PTR sys_tgkill
PTR sys_utimes
PTR sys_mbind
- PTR sys_ni_syscall /* sys_get_mempolicy */
- PTR sys_ni_syscall /* 4270 sys_set_mempolicy */
+ PTR sys_get_mempolicy
+ PTR sys_set_mempolicy /* 4270 */
PTR sys_mq_open
PTR sys_mq_unlink
PTR sys_mq_timedsend
diff --git a/arch/mips/kernel/scall64-64.S
b/arch/mips/kernel/scall64-64.S
index dd99c328..a4baf06 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -347,8 +347,8 @@ EXPORT(sys_call_table)
PTR sys_tgkill /* 5225 */
PTR sys_utimes
PTR sys_mbind
- PTR sys_ni_syscall /* sys_get_mempolicy */
- PTR sys_ni_syscall /* sys_set_mempolicy */
+ PTR sys_get_mempolicy
+ PTR sys_set_mempolicy
PTR sys_mq_open /* 5230 */
PTR sys_mq_unlink
PTR sys_mq_timedsend
diff --git a/arch/mips/kernel/scall64-n32.S
b/arch/mips/kernel/scall64-n32.S
index f68d2f4..92db19e 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -339,9 +339,9 @@ EXPORT(sysn32_call_table)
PTR compat_sys_clock_nanosleep
PTR sys_tgkill
PTR compat_sys_utimes /* 6230 */
- PTR sys_ni_syscall /* sys_mbind */
- PTR sys_ni_syscall /* sys_get_mempolicy */
- PTR sys_ni_syscall /* sys_set_mempolicy */
+ PTR sys_mbind
+ PTR sys_get_mempolicy
+ PTR sys_set_mempolicy
Here
PTR compat_sys_mq_open
PTR sys_mq_unlink /* 6235 */
PTR compat_sys_mq_timedsend
diff --git a/arch/mips/kernel/scall64-o32.S
b/arch/mips/kernel/scall64-o32.S
index 70f6ace..0230429 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -473,9 +473,9 @@ EXPORT(sys32_call_table)
PTR compat_sys_clock_nanosleep /* 4265 */
PTR sys_tgkill
PTR compat_sys_utimes
- PTR sys_ni_syscall /* sys_mbind */
- PTR sys_ni_syscall /* sys_get_mempolicy */
- PTR sys_ni_syscall /* 4270 sys_set_mempolicy */
+ PTR sys_mbind
+ PTR sys_get_mempolicy
+ PTR sys_set_mempolicy /* 4270 */
And Here.
PTR compat_sys_mq_open
PTR sys_mq_unlink
PTR compat_sys_mq_timedsend