Commit 9062e59e authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

vdso: move VMAs traverse cycle in vdso_proxify()

Reduce __export_restore_task(), which is fat and too long,
drop needless parameter from vdso_proxify() and drop also
that find-tuple logic, which isn't needed really.
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 2261748e
......@@ -82,7 +82,7 @@ static inline bool is_vdso_mark(void *addr)
extern int vdso_do_park(struct vdso_symtable *sym_rt, unsigned long park_at, unsigned long park_size);
extern int vdso_map_compat(unsigned long map_at);
extern int vdso_proxify(struct vdso_symtable *sym_rt,
unsigned long vdso_rt_parked_at, size_t index,
unsigned long vdso_rt_parked_at,
VmaEntry *vmas, size_t nr_vmas, bool compat_vdso);
#else /* CONFIG_VDSO */
......
......@@ -104,26 +104,29 @@ int __vdso_fill_symtable(uintptr_t mem, size_t size,
#endif
int vdso_proxify(struct vdso_symtable *sym_rt,
unsigned long vdso_rt_parked_at, size_t index,
unsigned long vdso_rt_parked_at,
VmaEntry *vmas, size_t nr_vmas, bool compat_vdso)
{
VmaEntry *vma_vdso = NULL, *vma_vvar = NULL;
struct vdso_symtable s = VDSO_SYMTABLE_INIT;
bool remap_rt = false;
unsigned int i;
/*
* Figure out which kind of vdso tuple we get.
*/
if (vma_entry_is(&vmas[index], VMA_AREA_VDSO))
vma_vdso = &vmas[index];
else if (vma_entry_is(&vmas[index], VMA_AREA_VVAR))
vma_vvar = &vmas[index];
if (index < (nr_vmas - 1)) {
if (vma_entry_is(&vmas[index + 1], VMA_AREA_VDSO))
vma_vdso = &vmas[index + 1];
else if (vma_entry_is(&vmas[index + 1], VMA_AREA_VVAR))
vma_vvar = &vmas[index + 1];
for (i = 0; i < nr_vmas; i++) {
if (vma_entry_is(&vmas[i], VMA_AREA_VDSO))
vma_vdso = &vmas[i];
else if (vma_entry_is(&vmas[i], VMA_AREA_VVAR))
vma_vvar = &vmas[i];
}
if (!vma_vdso && !vma_vvar) {
pr_info("No VVAR, no vDSO in image\n");
/*
* We don't have to unmap rt-vdso, rt-vvar as they will
* be unmapped with restorer blob in the end,
* see __export_unmap()
*/
return 0;
}
if (!vma_vdso) {
......
......@@ -1185,17 +1185,9 @@ long __export_restore_task(struct task_restore_args *args)
/*
* Proxify vDSO.
*/
for (i = 0; i < args->vmas_n; i++) {
if (vma_entry_is(&args->vmas[i], VMA_AREA_VDSO) ||
vma_entry_is(&args->vmas[i], VMA_AREA_VVAR)) {
if (vdso_proxify(&args->vdso_sym_rt,
args->vdso_rt_parked_at,
i, args->vmas, args->vmas_n,
args->compatible_mode))
goto core_restore_end;
break;
}
}
if (vdso_proxify(&args->vdso_sym_rt, args->vdso_rt_parked_at,
args->vmas, args->vmas_n, args->compatible_mode))
goto core_restore_end;
#endif
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment