cr: restore vDSO on i386/x86_64
Subsystems (4)
PATCH 18/30 cr: restore vDSO on i386/x86_64
FIXME: check VMA has same parameters.
FIXME: abort if target kernel has vDSO disabled (?)
FIXME: restore pages, vDSO is writable after all.
---
arch/x86/vdso/vdso32-setup.c | 6 ++ include/linux/cr.h | 11 +++++ include/linux/mm.h | 5 +- kernel/cr/cr-mm.c | 87 +++++++++++++++++++++++++++++++++++++++++++ mm/mmap.c | 3 + 5 files changed, 110 insertions(+), 2 deletions(-)
arch/x86/vdso/vdso32-setup.c +5 -1
@@ -328,6 +328,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, unsigned long start,map_compat_vdso (compat); +if (start) { + addr = start; + goto map; + }if (compat) addr =VDSO_HIGH_BASE ;else {
@@ -337,7 +341,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, unsigned long start, goto up_fail; } } - +map:if (compat_uses_vma || !compat) {/* * MAYWRITE to allow gdb to COW and set breakpoints
include/linux/cr.h +11 -0
@@ -34,6 +34,7 @@ struct cr_object_header {#define CR_OBJ_FILE 3#define CR_OBJ_VMA 4#define CR_OBJ_VMA_CONTENT 5 +#define CR_OBJ_VMA_VDSO 6__u32 cr_type;/* object type */ __u32 cr_len;/* object length in bytes including header */ } __packed;
@@ -177,6 +178,16 @@ struct cr_image_vma {cr_pos_t cr_pos_vm_file; } __packed; +struct cr_image_vma_vdso { +struct cr_object_header cr_hdr; + +__u64 cr_vm_start; +__u64 cr_vm_end; +__u64 cr_vm_page_prot; +__u64 cr_vm_flags; +__u64 cr_vm_pgoff; +} __packed; +struct cr_image_vma_content {struct cr_object_header cr_hdr;
include/linux/mm.h +4 -1
@@ -1129,7 +1129,10 @@ extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);extern int install_special_mapping (struct mm_struct *mm,unsigned long addr,unsigned long len,unsigned long flags,struct page **pages); - +#ifdef CONFIG_CR +struct cr_context ; +int special_mapping_checkpoint (struct vm_area_struct *vma,struct cr_context *ctx); +#endif extern unsigned long get_unmapped_area (struct file *,unsigned long ,unsigned long ,unsigned long ,unsigned long ); extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
kernel/cr/cr-mm.c +87 -0
99 lines not on this page · raw message
mm/mmap.c +3 -0
@@ -2257,6 +2257,9 @@ static void special_mapping_close(struct vm_area_struct *vma)static struct vm_operations_struct special_mapping_vmops = { .close = special_mapping_close, .fault = special_mapping_fault, +#ifdef CONFIG_CR + .checkpoint = special_mapping_checkpoint, +#endif };/*
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 17 lines · Alexey Dobriyan
FIXME: check VMA has same parameters.
FIXME: abort if target kernel has vDSO disabled (?)
FIXME: restore pages, vDSO is writable after all.Signed-off-by Alexey Dobriyan <[email protected]>---
arch/x86/vdso/vdso32-setup.c | 6 ++ include/linux/cr.h | 11 +++++ include/linux/mm.h | 5 +- kernel/cr/cr-mm.c | 87 +++++++++++++++++++++++++++++++++++++++++++ mm/mmap.c | 3 + 5 files changed, 110 insertions(+), 2 deletions(-)
arch/x86/vdso/vdso32-setup.c int arch_setup_additional_pages(struct linux_binprm *bprm, unsigned long start, · line 334
Quoted 7 lines
arch/x86/vdso/vdso32-setup.c +4
-0@@ -328,6 +328,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, unsigned long start,map_compat_vdso (compat); +if (start) { + addr = start; + goto map; + }
Hmm, is there any safety to be gained by using
arch_get_unmapped_area(NULL, start, PAGE_SIZE, 0, 0);
so as to make sure there is a free page?
arch/x86/vdso/vdso32-setup.c int arch_setup_additional_pages(struct linux_binprm *bprm, unsigned long start, · line 347
Quoted 12 lines
arch/x86/vdso/vdso32-setup.c +1
-1if (compat) addr =VDSO_HIGH_BASE ;else {@@ -337,7 +341,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, unsigned long start, goto up_fail; } } - +map:if (compat_uses_vma || !compat) {/* * MAYWRITE to allow gdb to COW and set breakpoints
thanks,
-serge
Quoted 17 lines · Alexey Dobriyan
FIXME: check VMA has same parameters.
FIXME: abort if target kernel has vDSO disabled (?)
FIXME: restore pages, vDSO is writable after all.Signed-off-by Alexey Dobriyan <[email protected]>---
arch/x86/vdso/vdso32-setup.c | 6 ++ include/linux/cr.h | 11 +++++ include/linux/mm.h | 5 +- kernel/cr/cr-mm.c | 87 +++++++++++++++++++++++++++++++++++++++++++ mm/mmap.c | 3 + 5 files changed, 110 insertions(+), 2 deletions(-)
arch/x86/vdso/vdso32-setup.c int arch_setup_additional_pages(struct linux_binprm *bprm, unsigned long start, · line 334
Quoted 7 lines
arch/x86/vdso/vdso32-setup.c +4
-0@@ -328,6 +328,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, unsigned long start,map_compat_vdso (compat); +if (start) { + addr = start; + goto map; + }
Hmm, is there any safety to be gained by using
arch_get_unmapped_area(NULL, start, PAGE_SIZE, 0, 0);
so as to make sure there is a free page?
arch/x86/vdso/vdso32-setup.c int arch_setup_additional_pages(struct linux_binprm *bprm, unsigned long start, · line 347
Quoted 12 lines
arch/x86/vdso/vdso32-setup.c +1
-1if (compat) addr =VDSO_HIGH_BASE ;else {@@ -337,7 +341,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, unsigned long start, goto up_fail; } } - +map:if (compat_uses_vma || !compat) {/* * MAYWRITE to allow gdb to COW and set breakpoints
thanks,
-serge