[lkml]   [2006]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[patch 04/30] Fix sys_move_pages when a NULL node list is passed.
-stable review patch.  If anyone has any objections, please let us know.

From: Stephen Rothwell <>

sys_move_pages() uses vmalloc() to allocate an array of structures
that is fills with information passed from user mode and then passes to
do_stat_pages() (in the case the node list is NULL). do_stat_pages()
depends on a marker in the node field of the structure to decide how large
the array is and this marker is correctly inserted into the last element
of the array. However, vmalloc() doesn't zero the memory it allocates
and if the user passes NULL for the node list, then the node fields are
not filled in (except for the end marker). If the memory the vmalloc()
returned happend to have a word with the marker value in it in just the
right place, do_pages_stat will fail to fill the status field of part
of the array and we will return (random) kernel data to user mode.

Signed-off-by: Stephen Rothwell <>
Acked-by: Christoph Lameter <>
Signed-off-by: Chris Wright <>
mm/migrate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- linux-
+++ linux-
@@ -950,7 +950,8 @@ asmlinkage long sys_move_pages(pid_t pid
goto out;

pm[i].node = node;
- }
+ } else
+ pm[i].node = 0; /* anything to not match MAX_NUMNODES */
/* End marker */
pm[nr_pages].node = MAX_NUMNODES;
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-11-16 03:47    [W:0.132 / U:6.164 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site