public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
* [PATCH] m68k: make sys_atomic_cmpxchg_32 work on classic m68k
@ 2012-07-27 22:20 Andreas Schwab
  2012-07-28 13:35 ` Thorsten Glaser
  2012-08-02 22:52 ` Geert Uytterhoeven
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Schwab @ 2012-07-27 22:20 UTC (permalink / raw)
  To: linux-m68k

User space access must always go through uaccess accessors, since on
classic m68k user space and kernel space are completely separate.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
 arch/m68k/kernel/sys_m68k.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 8623f8d..9a5932e 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -479,9 +479,13 @@ sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
 			goto bad_access;
 		}
 
-		mem_value = *mem;
+		/*
+		 * No need to check for EFAULT; we know that the page is
+		 * present and writable.
+		 */
+		__get_user(mem_value, mem);
 		if (mem_value == oldval)
-			*mem = newval;
+			__put_user(newval, mem);
 
 		pte_unmap_unlock(pte, ptl);
 		up_read(&mm->mmap_sem);
-- 
1.7.11.3


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH] m68k: make sys_atomic_cmpxchg_32 work on classic m68k
  2012-07-27 22:20 [PATCH] m68k: make sys_atomic_cmpxchg_32 work on classic m68k Andreas Schwab
@ 2012-07-28 13:35 ` Thorsten Glaser
  2012-08-02 22:52 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Thorsten Glaser @ 2012-07-28 13:35 UTC (permalink / raw)
  To: Ben Hutchings, stable; +Cc: linux-m68k

Andreas Schwab dixit:

>User space access must always go through uaccess accessors, since on
>classic m68k user space and kernel space are completely separate.
>
>Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>

This fixes my testcases, both the reduced two and the real-life
one (running apt-get update no longer freezes the system, yay!).

Ben, can we please get that in the next src:linux upload to sid?

Tested-by: Thorsten Glaser <tg@debian.org>

>---
> arch/m68k/kernel/sys_m68k.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
>diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
>index 8623f8d..9a5932e 100644
>--- a/arch/m68k/kernel/sys_m68k.c
>+++ b/arch/m68k/kernel/sys_m68k.c
>@@ -479,9 +479,13 @@ sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
> 			goto bad_access;
> 		}
> 
>-		mem_value = *mem;
>+		/*
>+		 * No need to check for EFAULT; we know that the page is
>+		 * present and writable.
>+		 */
>+		__get_user(mem_value, mem);
> 		if (mem_value == oldval)
>-			*mem = newval;
>+			__put_user(newval, mem);
> 
> 		pte_unmap_unlock(pte, ptl);
> 		up_read(&mm->mmap_sem);
>-- 
>1.7.11.3
>
>
>-- 
>Andreas Schwab, schwab@linux-m68k.org
>GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
>"And now for something completely different."
>

//mirabilos
-- 
13:37⎜«Natureshadow» Deep inside, I hate mirabilos. I mean, he's a good
guy. But he's always right! In every fsckin' situation, he's right. Even
with his deeply perverted taste in software and borked ambition towards
broken OSes - in the end, he's damn right about it :(! […] works in mksh

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

* Re: [PATCH] m68k: make sys_atomic_cmpxchg_32 work on classic m68k
  2012-07-27 22:20 [PATCH] m68k: make sys_atomic_cmpxchg_32 work on classic m68k Andreas Schwab
  2012-07-28 13:35 ` Thorsten Glaser
@ 2012-08-02 22:52 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2012-08-02 22:52 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: linux-m68k

On Sat, Jul 28, 2012 at 12:20 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> User space access must always go through uaccess accessors, since on
> classic m68k user space and kernel space are completely separate.
>
> Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>

Thanks, applied and queued for 3.6-rc1 and stable.

> ---
>  arch/m68k/kernel/sys_m68k.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
> index 8623f8d..9a5932e 100644
> --- a/arch/m68k/kernel/sys_m68k.c
> +++ b/arch/m68k/kernel/sys_m68k.c
> @@ -479,9 +479,13 @@ sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
>                         goto bad_access;
>                 }
>
> -               mem_value = *mem;
> +               /*
> +                * No need to check for EFAULT; we know that the page is
> +                * present and writable.
> +                */
> +               __get_user(mem_value, mem);
>                 if (mem_value == oldval)
> -                       *mem = newval;
> +                       __put_user(newval, mem);
>
>                 pte_unmap_unlock(pte, ptl);
>                 up_read(&mm->mmap_sem);
> --
> 1.7.11.3

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2012-08-02 22:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-27 22:20 [PATCH] m68k: make sys_atomic_cmpxchg_32 work on classic m68k Andreas Schwab
2012-07-28 13:35 ` Thorsten Glaser
2012-08-02 22:52 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox