summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>2015-08-28 14:14:15 +0300
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>2015-08-28 14:36:42 +0300
commitbf2fb6b4630e93faccdb108026080ee9441fa363 (patch)
tree466d1d0d557c25be428acab0bec9055cec5b5210
parenta2e5cc4edd58c153368ff610acd810f3e99949c6 (diff)
downloadswap-modules-bf2fb6b4630e93faccdb108026080ee9441fa363.tar.gz
swap-modules-bf2fb6b4630e93faccdb108026080ee9441fa363.tar.bz2
swap-modules-bf2fb6b4630e93faccdb108026080ee9441fa363.zip
[FIX] preload library
when libdl will be mapped Change-Id: I2156e3ba5b64e0ad4761aca95616f093d9815ef2 Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
-rw-r--r--preload/preload_pd.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/preload/preload_pd.c b/preload/preload_pd.c
index ec7a7eca..fcc2e6b7 100644
--- a/preload/preload_pd.c
+++ b/preload/preload_pd.c
@@ -310,6 +310,41 @@ out:
return page;
}
+static struct vm_area_struct *find_vma_by_dentry(struct mm_struct *mm,
+ struct dentry *dentry)
+{
+ struct vm_area_struct *vma;
+
+ for (vma = mm->mmap; vma; vma = vma->vm_next)
+ if (check_vma(vma, dentry))
+ return vma;
+
+ return NULL;
+}
+
+static void set_already_mapp(struct process_data *pd, struct mm_struct *mm)
+{
+ struct vm_area_struct *vma;
+ struct dentry *ld = preload_debugfs_get_loader_dentry();
+ struct dentry *handlers = handlers_info->dentry;
+
+ down_read(&mm->mmap_sem);
+ if (ld) {
+ vma = find_vma_by_dentry(mm, ld);
+ if (vma)
+ __set_loader_base(pd, vma->vm_start);
+ }
+
+ if (handlers) {
+ vma = find_vma_by_dentry(mm, handlers);
+ if (vma) {
+ __set_handlers_base(pd, vma->vm_start);
+ __set_state(pd, LOADED);
+ }
+ }
+ up_read(&mm->mmap_sem);
+}
+
static struct process_data *do_create_pd(struct task_struct *task)
{
struct process_data *pd;
@@ -334,6 +369,7 @@ static struct process_data *do_create_pd(struct task_struct *task)
__set_data_page(pd, page);
__set_attempts(pd, PRELOAD_MAX_ATTEMPTS);
+ set_already_mapp(pd, task->mm);
return pd;