linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] Constify compat_get_bitmap argument
@ 2006-10-26  3:26 Stephen Rothwell
  2006-10-26  3:33 ` [PATCH 2/3] Create compat_sys_migrate_pages Stephen Rothwell
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2006-10-26  3:26 UTC (permalink / raw)
  To: LKML; +Cc: ppc-dev, paulus, ak, linux-mm

This means we can call it when the bitmap we want to fetch is declared
const.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/linux/compat.h |    2 +-
 kernel/compat.c        |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

This is headed towards getting sys_migrate_pages wired up for powerpc.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/include/linux/compat.h b/include/linux/compat.h
index f4ebf96..f155319 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -196,7 +196,7 @@ #define BITS_PER_COMPAT_LONG    (8*sizeo
 #define BITS_TO_COMPAT_LONGS(bits) \
 	(((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG)
 
-long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask,
+long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
 		       unsigned long bitmap_size);
 long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
 		       unsigned long bitmap_size);
diff --git a/kernel/compat.c b/kernel/compat.c
index 75573e5..d4898aa 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -678,7 +678,7 @@ int get_compat_sigevent(struct sigevent
 		? -EFAULT : 0;
 }
 
-long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask,
+long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
 		       unsigned long bitmap_size)
 {
 	int i, j;
-- 
1.4.3.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] Create compat_sys_migrate_pages
  2006-10-26  3:26 [PATCH 1/3] Constify compat_get_bitmap argument Stephen Rothwell
@ 2006-10-26  3:33 ` Stephen Rothwell
  2006-10-26  3:34   ` [PATCH 3/3] [POWERPC] Wire up sys_migrate_pages Stephen Rothwell
                     ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Stephen Rothwell @ 2006-10-26  3:33 UTC (permalink / raw)
  To: LKML; +Cc: ppc-dev, paulus, ak, linux-mm

This is needed on bigendian 64bit architectures. The obvious way to do
this (taking the other compat_ routines in this file as examples) is to
use compat_alloc_user_space and copy the bitmasks back there, however you
cannot call compat_alloc_user_space twice for a single system call and
this method saves two copies of the bitmasks.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 mm/mempolicy.c |  107 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 93 insertions(+), 14 deletions(-)

Maybe the other compat routines in here should be converted to use
compat_get_nodes as well.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 617fb31..65c0281 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -854,6 +854,58 @@ static int get_nodes(nodemask_t *nodes,
 	return 0;
 }
 
+#ifdef CONFIG_COMPAT
+static int compat_get_nodes(nodemask_t *nodes,
+		const compat_ulong_t __user *nmask, unsigned long maxnode)
+{
+	unsigned long k;
+	unsigned long nlongs;
+	unsigned long nbits = maxnode - 1;
+	compat_ulong_t endmask;
+
+	if (maxnode == 0)
+		return -EINVAL;
+	nodes_clear(*nodes);
+	if (nbits == 0 || !nmask)
+		return 0;
+	if (nbits > PAGE_SIZE * BITS_PER_BYTE)
+		return -EINVAL;
+
+	nlongs = BITS_TO_COMPAT_LONGS(nbits);
+	if ((nbits % BITS_PER_COMPAT_LONG) == 0)
+		endmask = (compat_ulong_t)~0;
+	else
+		endmask = ((compat_ulong_t)1 <<
+				(nbits % BITS_PER_COMPAT_LONG)) - 1;
+
+	/* When the user specified more nodes than supported just check
+	   if the non supported part is all zero. */
+	if (nbits > MAX_NUMNODES) {
+		if (nlongs > PAGE_SIZE / sizeof(compat_ulong_t))
+			return -EINVAL;
+		for (k = BITS_TO_COMPAT_LONGS(MAX_NUMNODES); k < nlongs; k++) {
+			compat_ulong_t t;
+
+			if (get_user(t, nmask + k))
+				return -EFAULT;
+			if (k == (nlongs - 1)) {
+				if (t & endmask)
+					return -EINVAL;
+			} else if (t)
+				return -EINVAL;
+		}
+		nbits = MAX_NUMNODES;
+		endmask = ~0;
+	}
+
+	if (compat_get_bitmap(nodes_addr(*nodes), nmask, nbits))
+		return -EFAULT;
+	if (nbits % BITS_PER_COMPAT_LONG)
+		nodes_addr(*nodes)[BITS_TO_COMPAT_LONGS(nbits) - 1] &= endmask;
+	return 0;
+}
+#endif /* CONFIG_COMPAT */
+
 /* Copy a kernel node mask to user space */
 static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode,
 			      nodemask_t *nodes)
@@ -900,25 +952,13 @@ asmlinkage long sys_set_mempolicy(int mo
 	return do_set_mempolicy(mode, &nodes);
 }
 
-asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
-		const unsigned long __user *old_nodes,
-		const unsigned long __user *new_nodes)
+static long internal_migrate_pages(pid_t pid, nodemask_t *old, nodemask_t *new)
 {
 	struct mm_struct *mm;
 	struct task_struct *task;
-	nodemask_t old;
-	nodemask_t new;
 	nodemask_t task_nodes;
 	int err;
 
-	err = get_nodes(&old, old_nodes, maxnode);
-	if (err)
-		return err;
-
-	err = get_nodes(&new, new_nodes, maxnode);
-	if (err)
-		return err;
-
 	/* Find the mm_struct */
 	read_lock(&tasklist_lock);
 	task = pid ? find_task_by_pid(pid) : current;
@@ -963,6 +1003,25 @@ out:
 	return err;
 }
 
+asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
+		const unsigned long __user *old_nodes,
+		const unsigned long __user *new_nodes)
+{
+	nodemask_t old;
+	nodemask_t new;
+	int err;
+
+	err = get_nodes(&old, old_nodes, maxnode);
+	if (err)
+		return err;
+
+	err = get_nodes(&new, new_nodes, maxnode);
+	if (err)
+		return err;
+
+	return internal_migrate_pages(pid, old, new);
+}
+
 
 /* Retrieve NUMA policy */
 asmlinkage long sys_get_mempolicy(int __user *policy,
@@ -1067,7 +1126,27 @@ asmlinkage long compat_sys_mbind(compat_
 	return sys_mbind(start, len, mode, nm, nr_bits+1, flags);
 }
 
-#endif
+asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
+			compat_ulong_t maxnode,
+			const compat_ulong_t __user *old_nodes,
+			const compat_ulong_t __user *new_nodes)
+{
+	nodemask_t old;
+	nodemask_t new;
+	int err;
+
+	err = get_nodes(&old, old_nodes, maxnode);
+	if (err)
+		return err;
+
+	err = get_nodes(&new, new_nodes, maxnode);
+	if (err)
+		return err;
+
+	return internal_migrate_pages(pid, old, new);
+}
+
+#endif /* CONFIG_COMPAT */
 
 /* Return effective policy for a VMA */
 static struct mempolicy * get_vma_policy(struct task_struct *task,
-- 
1.4.3.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] [POWERPC] Wire up sys_migrate_pages
  2006-10-26  3:33 ` [PATCH 2/3] Create compat_sys_migrate_pages Stephen Rothwell
@ 2006-10-26  3:34   ` Stephen Rothwell
  2006-10-26  3:57   ` [PATCH 2/3] Create compat_sys_migrate_pages Stephen Rothwell
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2006-10-26  3:34 UTC (permalink / raw)
  To: LKML; +Cc: ppc-dev, paulus, ak, linux-mm


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/asm-powerpc/systbl.h |    1 +
 include/asm-powerpc/unistd.h |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index eac85ce..4708ebe 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -304,3 +304,4 @@ SYSCALL_SPU(fchmodat)
 SYSCALL_SPU(faccessat)
 COMPAT_SYS_SPU(get_robust_list)
 COMPAT_SYS_SPU(set_robust_list)
+COMPAT_SYS(migrate_pages)
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index 464a48c..4cdab3f 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -323,10 +323,11 @@ #define __NR_fchmodat		297
 #define __NR_faccessat		298
 #define __NR_get_robust_list	299
 #define __NR_set_robust_list	300
+#define __NR_migrate_pages	301
 
 #ifdef __KERNEL__
 
-#define __NR_syscalls		301
+#define __NR_syscalls		302
 
 #define __NR__exit __NR_exit
 #define NR_syscalls	__NR_syscalls
-- 
1.4.3.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] Create compat_sys_migrate_pages
  2006-10-26  3:33 ` [PATCH 2/3] Create compat_sys_migrate_pages Stephen Rothwell
  2006-10-26  3:34   ` [PATCH 3/3] [POWERPC] Wire up sys_migrate_pages Stephen Rothwell
@ 2006-10-26  3:57   ` Stephen Rothwell
  2006-10-26 23:04     ` Arnd Bergmann
  2006-10-26 19:00   ` Christoph Lameter
  2006-10-26 23:03   ` Arnd Bergmann
  3 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2006-10-26  3:57 UTC (permalink / raw)
  To: LKML; +Cc: ppc-dev, paulus, ak, linux-mm

This is needed on bigendian 64bit architectures. The obvious way to do
this (taking the other compat_ routines in this file as examples) is to
use compat_alloc_user_space and copy the bitmasks back there, however you
cannot call compat_alloc_user_space twice for a single system call and
this method saves two copies of the bitmasks.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 mm/mempolicy.c |  111 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 95 insertions(+), 16 deletions(-)

OOPS, forgot to add a couple of fixes.  Replacement of 2/3 only ...
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 617fb31..aa81d41 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -854,6 +854,58 @@ static int get_nodes(nodemask_t *nodes,
 	return 0;
 }
 
+#ifdef CONFIG_COMPAT
+static int compat_get_nodes(nodemask_t *nodes,
+		const compat_ulong_t __user *nmask, unsigned long maxnode)
+{
+	unsigned long k;
+	unsigned long nlongs;
+	unsigned long nbits = maxnode - 1;
+	compat_ulong_t endmask;
+
+	if (maxnode == 0)
+		return -EINVAL;
+	nodes_clear(*nodes);
+	if (nbits == 0 || !nmask)
+		return 0;
+	if (nbits > PAGE_SIZE * BITS_PER_BYTE)
+		return -EINVAL;
+
+	nlongs = BITS_TO_COMPAT_LONGS(nbits);
+	if ((nbits % BITS_PER_COMPAT_LONG) == 0)
+		endmask = (compat_ulong_t)~0;
+	else
+		endmask = ((compat_ulong_t)1 <<
+				(nbits % BITS_PER_COMPAT_LONG)) - 1;
+
+	/* When the user specified more nodes than supported just check
+	   if the non supported part is all zero. */
+	if (nbits > MAX_NUMNODES) {
+		if (nlongs > PAGE_SIZE / sizeof(compat_ulong_t))
+			return -EINVAL;
+		for (k = BITS_TO_COMPAT_LONGS(MAX_NUMNODES); k < nlongs; k++) {
+			compat_ulong_t t;
+
+			if (get_user(t, nmask + k))
+				return -EFAULT;
+			if (k == (nlongs - 1)) {
+				if (t & endmask)
+					return -EINVAL;
+			} else if (t)
+				return -EINVAL;
+		}
+		nbits = MAX_NUMNODES;
+		endmask = ~0;
+	}
+
+	if (compat_get_bitmap(nodes_addr(*nodes), nmask, nbits))
+		return -EFAULT;
+	if (nbits % BITS_PER_COMPAT_LONG)
+		nodes_addr(*nodes)[BITS_TO_COMPAT_LONGS(nbits) - 1] &= endmask;
+	return 0;
+}
+#endif /* CONFIG_COMPAT */
+
 /* Copy a kernel node mask to user space */
 static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode,
 			      nodemask_t *nodes)
@@ -900,25 +952,13 @@ asmlinkage long sys_set_mempolicy(int mo
 	return do_set_mempolicy(mode, &nodes);
 }
 
-asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
-		const unsigned long __user *old_nodes,
-		const unsigned long __user *new_nodes)
+static long internal_migrate_pages(pid_t pid, nodemask_t *old, nodemask_t *new)
 {
 	struct mm_struct *mm;
 	struct task_struct *task;
-	nodemask_t old;
-	nodemask_t new;
 	nodemask_t task_nodes;
 	int err;
 
-	err = get_nodes(&old, old_nodes, maxnode);
-	if (err)
-		return err;
-
-	err = get_nodes(&new, new_nodes, maxnode);
-	if (err)
-		return err;
-
 	/* Find the mm_struct */
 	read_lock(&tasklist_lock);
 	task = pid ? find_task_by_pid(pid) : current;
@@ -947,7 +987,7 @@ asmlinkage long sys_migrate_pages(pid_t
 
 	task_nodes = cpuset_mems_allowed(task);
 	/* Is the user allowed to access the target nodes? */
-	if (!nodes_subset(new, task_nodes) && !capable(CAP_SYS_NICE)) {
+	if (!nodes_subset(*new, task_nodes) && !capable(CAP_SYS_NICE)) {
 		err = -EPERM;
 		goto out;
 	}
@@ -956,13 +996,32 @@ asmlinkage long sys_migrate_pages(pid_t
 	if (err)
 		goto out;
 
-	err = do_migrate_pages(mm, &old, &new,
+	err = do_migrate_pages(mm, old, new,
 		capable(CAP_SYS_NICE) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE);
 out:
 	mmput(mm);
 	return err;
 }
 
+asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
+		const unsigned long __user *old_nodes,
+		const unsigned long __user *new_nodes)
+{
+	nodemask_t old;
+	nodemask_t new;
+	int err;
+
+	err = get_nodes(&old, old_nodes, maxnode);
+	if (err)
+		return err;
+
+	err = get_nodes(&new, new_nodes, maxnode);
+	if (err)
+		return err;
+
+	return internal_migrate_pages(pid, &old, &new);
+}
+
 
 /* Retrieve NUMA policy */
 asmlinkage long sys_get_mempolicy(int __user *policy,
@@ -1067,7 +1126,27 @@ asmlinkage long compat_sys_mbind(compat_
 	return sys_mbind(start, len, mode, nm, nr_bits+1, flags);
 }
 
-#endif
+asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
+			compat_ulong_t maxnode,
+			const compat_ulong_t __user *old_nodes,
+			const compat_ulong_t __user *new_nodes)
+{
+	nodemask_t old;
+	nodemask_t new;
+	int err;
+
+	err = compat_get_nodes(&old, old_nodes, maxnode);
+	if (err)
+		return err;
+
+	err = compat_get_nodes(&new, new_nodes, maxnode);
+	if (err)
+		return err;
+
+	return internal_migrate_pages(pid, &old, &new);
+}
+
+#endif /* CONFIG_COMPAT */
 
 /* Return effective policy for a VMA */
 static struct mempolicy * get_vma_policy(struct task_struct *task,
-- 
1.4.3.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] Create compat_sys_migrate_pages
  2006-10-26  3:33 ` [PATCH 2/3] Create compat_sys_migrate_pages Stephen Rothwell
  2006-10-26  3:34   ` [PATCH 3/3] [POWERPC] Wire up sys_migrate_pages Stephen Rothwell
  2006-10-26  3:57   ` [PATCH 2/3] Create compat_sys_migrate_pages Stephen Rothwell
@ 2006-10-26 19:00   ` Christoph Lameter
  2006-10-27  0:28     ` Stephen Rothwell
  2006-10-26 23:03   ` Arnd Bergmann
  3 siblings, 1 reply; 10+ messages in thread
From: Christoph Lameter @ 2006-10-26 19:00 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-mm, ppc-dev, paulus, LKML, ak

On Thu, 26 Oct 2006, Stephen Rothwell wrote:

> This is needed on bigendian 64bit architectures. The obvious way to do
> this (taking the other compat_ routines in this file as examples) is to
> use compat_alloc_user_space and copy the bitmasks back there, however you
> cannot call compat_alloc_user_space twice for a single system call and
> this method saves two copies of the bitmasks.

Well this means also that sys_mbind and sys_set_mempolicy are also
broken because these functions also use get_nodes().

Fixing get_nodes() to do the proper thing would fix all of these 
without having to touch sys_migrate_pages or creating a compat_ function 
(which usually is placed in kernel/compat.c)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] Create compat_sys_migrate_pages
  2006-10-26  3:33 ` [PATCH 2/3] Create compat_sys_migrate_pages Stephen Rothwell
                     ` (2 preceding siblings ...)
  2006-10-26 19:00   ` Christoph Lameter
@ 2006-10-26 23:03   ` Arnd Bergmann
  3 siblings, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2006-10-26 23:03 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-mm, ppc-dev, paulus, LKML, ak

T24gVGh1cnNkYXkgMjYgT2N0b2JlciAyMDA2IDA1OjMzLCBTdGVwaGVuIFJvdGh3ZWxsIHdyb3Rl
Ogo+ICthc21saW5rYWdlIGxvbmcgY29tcGF0X3N5c19taWdyYXRlX3BhZ2VzKGNvbXBhdF9waWRf
dCBwaWQsCj4gK6CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgY29tcGF0X3Vsb25nX3QgbWF4bm9kZSwK
PiAroKCgoKCgoKCgoKCgoKCgoKCgoKCgoKBjb25zdCBjb21wYXRfdWxvbmdfdCBfX3VzZXIgKm9s
ZF9ub2RlcywKPiAroKCgoKCgoKCgoKCgoKCgoKCgoKCgoKBjb25zdCBjb21wYXRfdWxvbmdfdCBf
X3VzZXIgKm5ld19ub2RlcykKPiArewo+ICugoKCgoKCgbm9kZW1hc2tfdCBvbGQ7Cj4gK6CgoKCg
oKBub2RlbWFza190IG5ldzsKPiAroKCgoKCgoGludCBlcnI7Cj4gKwo+ICugoKCgoKCgZXJyID0g
Z2V0X25vZGVzKCZvbGQsIG9sZF9ub2RlcywgbWF4bm9kZSk7Cj4gK6CgoKCgoKBpZiAoZXJyKQo+
ICugoKCgoKCgoKCgoKCgoKByZXR1cm4gZXJyOwo+ICsKPiAroKCgoKCgoGVyciA9IGdldF9ub2Rl
cygmbmV3LCBuZXdfbm9kZXMsIG1heG5vZGUpOwoKSSBndWVzcyB5b3Ugd2FudCB0byBjYWxsIGNv
bXBhdF9nZXRfbm9kZXMsIG5vdCBnZXRfbm9kZXMgaGVyZSwKcmlnaHQ/CgoJQXJuZCA8PjwK

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] Create compat_sys_migrate_pages
  2006-10-26  3:57   ` [PATCH 2/3] Create compat_sys_migrate_pages Stephen Rothwell
@ 2006-10-26 23:04     ` Arnd Bergmann
  0 siblings, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2006-10-26 23:04 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-mm, ppc-dev, paulus, LKML, ak

On Thursday 26 October 2006 05:57, Stephen Rothwell wrote:
> OOPS, forgot to add a couple of fixes. =A0Replacement of 2/3 only ...

Ok, so forget my reply to that.

	Arnd <><

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] Create compat_sys_migrate_pages
  2006-10-26 19:00   ` Christoph Lameter
@ 2006-10-27  0:28     ` Stephen Rothwell
  2006-10-27 13:24       ` Christoph Lameter
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2006-10-27  0:28 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-mm, ppc-dev, paulus, LKML, ak

[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]

On Thu, 26 Oct 2006 12:00:30 -0700 (PDT) Christoph Lameter <clameter@sgi.com> wrote:
>
> On Thu, 26 Oct 2006, Stephen Rothwell wrote:
>
> > This is needed on bigendian 64bit architectures. The obvious way to do
> > this (taking the other compat_ routines in this file as examples) is to
> > use compat_alloc_user_space and copy the bitmasks back there, however you
> > cannot call compat_alloc_user_space twice for a single system call and
> > this method saves two copies of the bitmasks.
>
> Well this means also that sys_mbind and sys_set_mempolicy are also
> broken because these functions also use get_nodes().

No they aren't because they have compat routines that convert the bitmaps
before calling the "normal" syscall.  They, importantly, only use
compat_alloc_user_space once each.

> Fixing get_nodes() to do the proper thing would fix all of these
> without having to touch sys_migrate_pages or creating a compat_ function
> (which usually is placed in kernel/compat.c)

You need the compat_ version of the syscalls to know if you were called
from a 32bit application in order to know if you may need to fixup the
bitmaps that are passed from/to user mode.

--
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] Create compat_sys_migrate_pages
  2006-10-27  0:28     ` Stephen Rothwell
@ 2006-10-27 13:24       ` Christoph Lameter
  2006-10-30  5:29         ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Christoph Lameter @ 2006-10-27 13:24 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-mm, ppc-dev, paulus, LKML, ak

On Fri, 27 Oct 2006, Stephen Rothwell wrote:

> No they aren't because they have compat routines that convert the bitmaps
> before calling the "normal" syscall.  They, importantly, only use
> compat_alloc_user_space once each.

Ah...

> > Fixing get_nodes() to do the proper thing would fix all of these
> > without having to touch sys_migrate_pages or creating a compat_ function
> > (which usually is placed in kernel/compat.c)
> 
> You need the compat_ version of the syscalls to know if you were called
> from a 32bit application in order to know if you may need to fixup the
> bitmaps that are passed from/to user mode.

The compat functions should be placed in kernel/compat.c next to 
compat_sys_move_pages.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] Create compat_sys_migrate_pages
  2006-10-27 13:24       ` Christoph Lameter
@ 2006-10-30  5:29         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2006-10-30  5:29 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: Stephen Rothwell, ppc-dev, ak, LKML, linux-mm, paulus

On Fri, 2006-10-27 at 06:24 -0700, Christoph Lameter wrote:
> On Fri, 27 Oct 2006, Stephen Rothwell wrote:
> 
> > No they aren't because they have compat routines that convert the bitmaps
> > before calling the "normal" syscall.  They, importantly, only use
> > compat_alloc_user_space once each.
> 
> Ah...
> 
> > > Fixing get_nodes() to do the proper thing would fix all of these
> > > without having to touch sys_migrate_pages or creating a compat_ function
> > > (which usually is placed in kernel/compat.c)
> > 
> > You need the compat_ version of the syscalls to know if you were called
> > from a 32bit application in order to know if you may need to fixup the
> > bitmaps that are passed from/to user mode.
> 
> The compat functions should be placed in kernel/compat.c next to 
> compat_sys_move_pages.

I disagree.. it's really annoying when they are away from their
respective "non-compat" function, especially when they are more than
just wrappers copying/converting arguments...

Now, if only we had done a sane ABI in the first place...
 
Ben.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-10-30  5:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-26  3:26 [PATCH 1/3] Constify compat_get_bitmap argument Stephen Rothwell
2006-10-26  3:33 ` [PATCH 2/3] Create compat_sys_migrate_pages Stephen Rothwell
2006-10-26  3:34   ` [PATCH 3/3] [POWERPC] Wire up sys_migrate_pages Stephen Rothwell
2006-10-26  3:57   ` [PATCH 2/3] Create compat_sys_migrate_pages Stephen Rothwell
2006-10-26 23:04     ` Arnd Bergmann
2006-10-26 19:00   ` Christoph Lameter
2006-10-27  0:28     ` Stephen Rothwell
2006-10-27 13:24       ` Christoph Lameter
2006-10-30  5:29         ` Benjamin Herrenschmidt
2006-10-26 23:03   ` Arnd Bergmann

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).