2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

images: Add protobuf definition for pidfd

We only use the last pid from the list in NSpid entry (from
/proc/<pid>/fdinfo/<pidfd>) while restoring pidfds.
The last pid refers to the pid of the process in the most deeply nested
pid namespace. Since CRIU does not currently support nested pid
namespaces, this entry is the one we want.

After Linux 6.9, inode numbers can be used to compare pidfds. pidfds
referring to the same process will have the same inode numbers. We use
inode numbers to restore pidfds that point to dead processes.

Signed-off-by: Bhavik Sachdev <b.sachdev1904@gmail.com>
This commit is contained in:
Bhavik Sachdev 2024-06-13 20:00:09 +05:30 committed by Andrei Vagin
parent 9463371787
commit a1db7627b9
3 changed files with 17 additions and 0 deletions

View File

@ -73,6 +73,7 @@ proto-obj-y += bpfmap-file.o
proto-obj-y += bpfmap-data.o proto-obj-y += bpfmap-data.o
proto-obj-y += apparmor.o proto-obj-y += apparmor.o
proto-obj-y += rseq.o proto-obj-y += rseq.o
proto-obj-y += pidfd.o
CFLAGS += -iquote $(obj)/ CFLAGS += -iquote $(obj)/

View File

@ -17,6 +17,7 @@ import "ext-file.proto";
import "sk-unix.proto"; import "sk-unix.proto";
import "fifo.proto"; import "fifo.proto";
import "pipe.proto"; import "pipe.proto";
import "pidfd.proto";
import "tty.proto"; import "tty.proto";
import "memfd.proto"; import "memfd.proto";
import "bpfmap-file.proto"; import "bpfmap-file.proto";
@ -42,6 +43,7 @@ enum fd_types {
TIMERFD = 17; TIMERFD = 17;
MEMFD = 18; MEMFD = 18;
BPFMAP = 19; BPFMAP = 19;
PIDFD = 20;
/* Any number above the real used. Not stored to image */ /* Any number above the real used. Not stored to image */
CTL_TTY = 65534; CTL_TTY = 65534;
@ -78,4 +80,5 @@ message file_entry {
optional tty_file_entry tty = 19; optional tty_file_entry tty = 19;
optional memfd_file_entry memfd = 20; optional memfd_file_entry memfd = 20;
optional bpfmap_file_entry bpf = 21; optional bpfmap_file_entry bpf = 21;
optional pidfd_entry pidfd = 22;
} }

13
images/pidfd.proto Normal file
View File

@ -0,0 +1,13 @@
// SPDX-License-Identifier: MIT
syntax = "proto2";
import "fown.proto";
message pidfd_entry {
required uint32 id = 1;
required uint32 ino = 2;
required uint32 flags = 3;
required int32 nspid = 4;
required fown_entry fown = 5;
}