From a2e5cc4edd58c153368ff610acd810f3e99949c6 Mon Sep 17 00:00:00 2001 From: Vyacheslav Cherkashin Date: Fri, 28 Aug 2015 14:10:13 +0300 Subject: [PATCH] [FIX] mmap allocation atribute PROT_WRITE atribute is needed for writing into allocated memory Change-Id: I6beb96bae7c331024b99fb2675bcde4430e1f9f0 Signed-off-by: Vyacheslav Cherkashin --- preload/preload_pd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/preload/preload_pd.c b/preload/preload_pd.c index 568b310..ec7a7ec 100644 --- a/preload/preload_pd.c +++ b/preload/preload_pd.c @@ -290,7 +290,7 @@ static unsigned long make_preload_path(void) size_t len = strnlen(path, PATH_MAX); down_write(¤t->mm->mmap_sem); - page = swap_do_mmap(NULL, 0, PAGE_SIZE, PROT_READ, + page = swap_do_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0); up_write(¤t->mm->mmap_sem); @@ -301,7 +301,7 @@ static unsigned long make_preload_path(void) } /* set preload_library path */ - if (copy_to_user((void __user *)page, path, len) <= 0) + if (copy_to_user((void __user *)page, path, len) != 0) printk(KERN_ERR PRELOAD_PREFIX "Cannot copy string to user!\n"); } -- 2.7.4