* [PATCH] Memset the kernel copy of rtas args before using
@ 2008-07-25 21:25 Nathan Fontenot
2008-07-26 4:17 ` Milton Miller
2008-07-26 10:52 ` Sergei Shtylyov
0 siblings, 2 replies; 3+ messages in thread
From: Nathan Fontenot @ 2008-07-25 21:25 UTC (permalink / raw)
To: linuxppc-dev
The kernel copy of the rtas args struct that is read in from
user space is a stack variable. This structure should be
zero'ed out before we do any reads/writes to/from the user
when handling a rtas call request. This patch adds a memset
to do this.
I am seeing an issue in testing partition mobility, where the
parts of the rtas args struct that return status top the user
contain stale data.
Signed-off-by: Nathan Fontenot <nfont@ausitn,ibm.com>
---
Index: linux-2.6.git/arch/powerpc/kernel/rtas.c
===================================================================
--- linux-2.6.git.orig/arch/powerpc/kernel/rtas.c 2008-07-22 09:34:03.000000000 -0500
+++ linux-2.6.git/arch/powerpc/kernel/rtas.c 2008-07-25 16:06:00.000000000 -0500
@@ -775,6 +775,8 @@
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
+ memset(&args, 0, sizeof(args));
+
if (copy_from_user(&args, uargs, 3 * sizeof(u32)) != 0)
return -EFAULT;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Memset the kernel copy of rtas args before using
2008-07-25 21:25 [PATCH] Memset the kernel copy of rtas args before using Nathan Fontenot
@ 2008-07-26 4:17 ` Milton Miller
2008-07-26 10:52 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Milton Miller @ 2008-07-26 4:17 UTC (permalink / raw)
To: Nathan Fontenot; +Cc: ppcdev, Paul Mackerras
On Sat Jul 26 at 07:25:47 EST in 2008, Nathan Fontenot wrote:
> The kernel copy of the rtas args struct that is read in from
> user space is a stack variable. This structure should be
> zero'ed out before we do any reads/writes to/from the user
> when handling a rtas call request. This patch adds a memset
> to do this.
Why bother to zero the data before copying from the user? We
check that they supply data for the whole input range needed.
> I am seeing an issue in testing partition mobility, where the
> parts of the rtas args struct that return status top the user
> contain stale data.
Please change the patch to just clear the output arg range.
(I"m fine not trusting firmware to set all output args based
on what the user suggested the return arg count would be).
And we can do it after we decide not to return an error:
792 if (args.token == RTAS_UNKNOWN_SERVICE)
793 return -EINVAL;
794
795 /* Need to handle ibm,suspend_me call specially */
milton
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Memset the kernel copy of rtas args before using
2008-07-25 21:25 [PATCH] Memset the kernel copy of rtas args before using Nathan Fontenot
2008-07-26 4:17 ` Milton Miller
@ 2008-07-26 10:52 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2008-07-26 10:52 UTC (permalink / raw)
To: Nathan Fontenot; +Cc: linuxppc-dev
Hello.
Nathan Fontenot wrote:
> Index: linux-2.6.git/arch/powerpc/kernel/rtas.c
> ===================================================================
> --- linux-2.6.git.orig/arch/powerpc/kernel/rtas.c 2008-07-22
> 09:34:03.000000000 -0500
> +++ linux-2.6.git/arch/powerpc/kernel/rtas.c 2008-07-25
> 16:06:00.000000000 -0500
> @@ -775,6 +775,8 @@
> if (!capable(CAP_SYS_ADMIN))
> return -EPERM;
>
> + memset(&args, 0, sizeof(args));
> +
You could use memzero() directly -- memset(x, 0, sizeof(x))l should
boil down to it anyway...
> if (copy_from_user(&args, uargs, 3 * sizeof(u32)) != 0)
> return -EFAULT;
WBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-26 10:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-25 21:25 [PATCH] Memset the kernel copy of rtas args before using Nathan Fontenot
2008-07-26 4:17 ` Milton Miller
2008-07-26 10:52 ` Sergei Shtylyov
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).