-
Notifications
You must be signed in to change notification settings - Fork 678
Handle processes with uprobes vma #2717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3cb2aae
eefcbb8
ff0edb1
9efd035
d989572
fcb6b95
349411c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,6 +74,12 @@ | |
| * about virtual address space ranges covered by | ||
| * MADV_GUARD_INSTALL guards. These ones must be always at | ||
| * the end of the vma_area_list and properly skipped a.e. | ||
| * - uprobes | ||
| * stands for a "[uprobes]" vma that's automatically mapped by | ||
| * the kernel when an active uprobe is hit. Contents of this vma | ||
| * are not dumped and neither are its madvise bits restored, | ||
| * because the kernel is in complete control of this vma. This is | ||
| * just used to track the existence of the uprobes vma. | ||
| */ | ||
| #define VMA_AREA_NONE (0 << 0) | ||
| #define VMA_AREA_REGULAR (1 << 0) | ||
|
|
@@ -94,6 +100,7 @@ | |
| #define VMA_AREA_MEMFD (1 << 14) | ||
| #define VMA_AREA_SHSTK (1 << 15) | ||
| #define VMA_AREA_GUARD (1 << 16) | ||
| #define VMA_AREA_UPROBES (1 << 17) | ||
|
Check warning on line 103 in criu/include/image.h
|
||
|
|
||
| #define VMA_EXT_PLUGIN (1 << 27) | ||
| #define VMA_CLOSE (1 << 28) | ||
|
|
@@ -107,6 +114,8 @@ | |
|
|
||
| #define CR_PARENT_LINK "parent" | ||
|
|
||
| #define OPT_ALLOW_UPROBES "allow-uprobes" | ||
|
|
||
| extern bool ns_per_id; | ||
| extern bool img_common_magic; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,6 +74,8 @@ | |
|
|
||
| static struct buffer __buf; | ||
| static char *buf = __buf.buf; | ||
| /* only ever goes from false to true, if at all */ | ||
| static bool uprobes_vma_exists = false; | ||
|
|
||
| /* | ||
| * This is how AIO ring buffers look like in proc | ||
|
|
@@ -202,8 +204,11 @@ | |
| * vmsplice doesn't work for VM_IO and VM_PFNMAP mappings, the | ||
| * only exception is VVAR area that mapped by the kernel as | ||
| * VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP | ||
| * | ||
| * The uprobes vma is also mapped by the kernel with VM_IO, among other flags | ||
| */ | ||
| if (io_pf && !vma_area_is(vma_area, VMA_AREA_VVAR) && !vma_entry_is(vma_area->e, VMA_FILE_SHARED)) | ||
| if (io_pf && !vma_area_is(vma_area, VMA_AREA_VVAR) && !vma_entry_is(vma_area->e, VMA_FILE_SHARED) | ||
|
Check warning on line 210 in criu/proc_parse.c
|
||
| && !vma_area_is(vma_area, VMA_AREA_UPROBES)) | ||
| vma_area->e->status |= VMA_UNSUPP; | ||
|
|
||
| if (vma_area->e->madv) | ||
|
|
@@ -603,6 +608,14 @@ | |
| goto err; | ||
| } else if (!strcmp(file_path, "[heap]")) { | ||
| vma_area->e->status |= VMA_AREA_REGULAR | VMA_AREA_HEAP; | ||
| } else if (!strcmp(file_path, "[uprobes]")) { | ||
| uprobes_vma_exists = true; | ||
| if (!opts.allow_uprobes) { | ||
| pr_err("PID %d has uprobes vma. Consider using --" OPT_ALLOW_UPROBES ".\n", | ||
| pid); | ||
|
Check warning on line 615 in criu/proc_parse.c
|
||
| goto err; | ||
| } | ||
| vma_area->e->status |= VMA_AREA_UPROBES; | ||
| } else { | ||
| vma_area->e->status = VMA_AREA_REGULAR; | ||
| } | ||
|
|
@@ -739,6 +752,10 @@ | |
| */ | ||
| pr_debug("Device file mapping %016" PRIx64 "-%016" PRIx64 " supported via device plugins\n", | ||
| vma_area->e->start, vma_area->e->end); | ||
| } else if (vma_area->e->status & VMA_AREA_UPROBES) { | ||
| pr_debug("Skipping uprobes vma %016" PRIx64 "-%016" PRIx64 "\n", vma_area->e->start, | ||
| vma_area->e->end); | ||
|
Check warning on line 757 in criu/proc_parse.c
|
||
| return 0; | ||
| } else if (vma_area->e->status & VMA_UNSUPP) { | ||
| pr_err("Unsupported mapping found %016" PRIx64 "-%016" PRIx64 "\n", vma_area->e->start, | ||
| vma_area->e->end); | ||
|
|
@@ -2929,3 +2946,8 @@ | |
| fclose(f); | ||
| return 0; | ||
| } | ||
|
|
||
| bool found_uprobes_vma(void) | ||
| { | ||
| return uprobes_vma_exists; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.