fault/vdso/restorer: add force-injection of trampolines

To check that jump trampolines to rt-vdso works.

Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Dmitry Safonov 2017-02-16 19:20:45 +03:00 committed by Andrei Vagin
parent d4a60bb201
commit a90c07d6dd
5 changed files with 10 additions and 6 deletions

View file

@ -11,6 +11,7 @@ enum faults {
FI_PARASITE_CONNECT,
FI_POST_RESTORE,
/* not fatal */
FI_VDSO_TRAMPOLINES = 127,
FI_CHECK_OPEN_HANDLE = 128,
FI_NO_MEMFD = 129,
FI_NO_BREAKPOINTS = 130,

View file

@ -83,7 +83,8 @@ extern int vdso_do_park(struct vdso_symtable *sym_rt, unsigned long park_at, uns
extern int vdso_map_compat(unsigned long map_at);
extern int vdso_proxify(struct vdso_symtable *sym_rt,
unsigned long vdso_rt_parked_at,
VmaEntry *vmas, size_t nr_vmas, bool compat_vdso);
VmaEntry *vmas, size_t nr_vmas,
bool compat_vdso, bool force_trampolines);
#else /* CONFIG_VDSO */
#define vdso_do_park(sym_rt, park_at, park_size) (0)

View file

@ -103,9 +103,9 @@ 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,
VmaEntry *vmas, size_t nr_vmas, bool compat_vdso)
int vdso_proxify(struct vdso_symtable *sym_rt, unsigned long vdso_rt_parked_at,
VmaEntry *vmas, size_t nr_vmas,
bool compat_vdso, bool force_trampolines)
{
VmaEntry *vma_vdso = NULL, *vma_vvar = NULL;
struct vdso_symtable s = VDSO_SYMTABLE_INIT;
@ -193,7 +193,7 @@ int vdso_proxify(struct vdso_symtable *sym_rt,
* by a caller code. So drop VMA_AREA_REGULAR from it and caller would
* not touch it anymore.
*/
if (remap_rt) {
if (remap_rt && !force_trampolines) {
int ret = 0;
pr_info("Runtime vdso/vvar matches dumpee, remap inplace\n");

View file

@ -1193,7 +1193,8 @@ long __export_restore_task(struct task_restore_args *args)
* Proxify vDSO.
*/
if (vdso_proxify(&args->vdso_sym_rt, args->vdso_rt_parked_at,
args->vmas, args->vmas_n, args->compatible_mode))
args->vmas, args->vmas_n, args->compatible_mode,
fault_injected(FI_VDSO_TRAMPOLINES)))
goto core_restore_end;
#endif

View file

@ -9,6 +9,7 @@ prep
./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --keep-going --pre 2 -f uns || fail
./test/zdtm.py run -t zdtm/static/env00 --fault 129 -f uns || fail
./test/zdtm.py run -t zdtm/transition/fork --fault 130 -f h || fail
./test/zdtm.py run -t zdtm/static/vdso01 --fault 127 || fail
./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 2 --keep-going --report report || fail
./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 --keep-going --report report || fail