On >= 2.6.11 check that the pages are present and readable before reading

Fri Apr 22 00:09:16 2005  Soeren Sandmann  <sandmann@redhat.com>

	* sysprof-module.c (read_user_space): On >= 2.6.11 check that the
	pages are present and readable before reading them.
This commit is contained in:
Soeren Sandmann
2005-04-22 04:14:37 +00:00
committed by Søren Sandmann Pedersen
parent 61430f6b96
commit 7b67e2c6b9
3 changed files with 15 additions and 3 deletions

View File

@ -157,8 +157,13 @@ read_user_space (userspace_reader *reader,
{
unsigned long cache_address = reader->cache_address;
int index, r;
if (!cache_address || cache_address != (address & PAGE_MASK)) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION (2,6,11)
if (!check_user_page_readable (reader->task->mm, address))
return 0;
#endif
cache_address = address & PAGE_MASK;
r = x_access_process_vm (reader->task, cache_address,
@ -258,7 +263,7 @@ static void
do_generate (void *data)
{
struct task_struct *task = data;
generate_stack_trace(task, head);
wake_up_process (task);