From 7b67e2c6b9688fc26df3399f9619f0dbbd522771 Mon Sep 17 00:00:00 2001 From: Soeren Sandmann Date: Fri, 22 Apr 2005 04:14:37 +0000 Subject: [PATCH] On >= 2.6.11 check that the pages are present and readable before reading Fri Apr 22 00:09:16 2005 Soeren Sandmann * sysprof-module.c (read_user_space): On >= 2.6.11 check that the pages are present and readable before reading them. --- ChangeLog | 5 +++++ TODO | 4 +++- sysprof-module.c | 9 +++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98302529..02720a6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Apr 22 00:09:16 2005 Soeren Sandmann + + * sysprof-module.c (read_user_space): On >= 2.6.11 check that the + pages are present and readable before reading them. + Tue Apr 19 23:26:45 2005 Kristian Høgsberg * Makefile (check): Add simple check target that runs a sanity diff --git a/TODO b/TODO index 8b0f151e..2c86ebc8 100644 --- a/TODO +++ b/TODO @@ -39,7 +39,8 @@ Before 1.2: - when you click something in the main list and we don't respond within 50ms (or perhaps when we expect to not be able to do so (can we know the size in advance?)) - - instead of as we do now: set the busy cursor unconditionally + - instead of what we do now: set the busy cursor unconditionally + - Reorganise stackstash and profile - stackstash should just take traces of addresses without knowing @@ -82,6 +83,7 @@ Before 1.2: - Consider adding KDE-style nested callgraph view - Add support for line numbers within functions - consider caching [filename => bin_file] +- rethink caller list, not terribly useful at the moment. - Have kernel module report the file the address was found in Should avoid a lot of potential broken/raciness with dlopen etc. diff --git a/sysprof-module.c b/sysprof-module.c index abcc08a8..bef47f40 100644 --- a/sysprof-module.c +++ b/sysprof-module.c @@ -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);