criu/images
Cyrill Gorcunov ffa54cfb1d seccomp: Add engine to restore per-thread seccomp chains
At now we pretend that all threads are sharing seccomp chains
and at checkpoint moment we test seccomp modes to make sure
if this assumption is valid refusing to dump otherwise.

Still the kernel tacks seccomp filter chains per each thread
and now we've faced applications (such as java) where per-thread
chains are actively used. Thus we need to bring support of handling
filters via per-thread basis.

In this a bit intrusive patch the restore engine is lifted up
to treat each thread separately. Here what is done:

 - Image core file is modified to keep seccomp filters
   inside thread_core_entry. For backward compatibility
   former seccomp_mode and seccomp_filter members in
   task_core_entry are renamed to have old_ prefix and
   on restore we test if we're dealing with old images.

   Since per-thread dump is not yet implemeneted the
   dumping procedure continue operating with old_ members.

 - In pie restorer code memory containing filters are addressed
   from inside thread_restore_args structure which now
   contains seccomp mode itself and chain attributes
   (number of filters and etc).

   Reading of per-thread data is done in seccomp_prepare_threads
   helper -- we take one pstree_item and walks over every thread
   inside to allocate pie memory and pin data there.

   Because of PIE specific, before jumping into pie code
   we have to relocate this memory into new place and
   for this seccomp_rst_reloc is served.

   In restorer itself we check if thread_restore_args provides
   us enabled seccomp mode (strict or filter passed) and call
   for restore_seccomp_filter if needed.

 - To unify names we start using seccomp_ prefix for all related
   stuff involved into this change (prepare_seccomp_filters renamed
   to seccomp_read_image because it only reads image and nothing
   more, image handler is renamed to seccomp_img_entry instead
   of too short 'se'.

With this change we're now allowed to start collecting and
dumping seccomp filters per each thread, which will be
done in next patch.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-05-15 03:51:16 +03:00
..
google/protobuf build: Move @protobuf dir into @images 2016-02-15 15:32:27 +03:00
autofs.proto images: add syntax specifier to autofs.proto 2016-10-10 12:49:28 +03:00
binfmt-misc.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
cgroup.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
core-aarch64.proto core-aarch64: mark gregs and clear_tid_addr as (criu).hex 2016-10-24 16:00:15 +03:00
core-arm.proto core-arm: mark gregs and clear_tid_addr as (criu).hex 2016-10-24 16:00:15 +03:00
core-ppc64.proto core-ppc64: mark gregs and clear_tid_addr as (criu).hex 2016-10-24 16:00:15 +03:00
core-s390.proto s390: Add runtime-instrumentation support 2017-10-17 08:40:44 +03:00
core-x86.proto criu: arch, x86 -- Rename registers mode 2017-03-14 23:58:07 +03:00
core.proto seccomp: Add engine to restore per-thread seccomp chains 2018-05-15 03:51:16 +03:00
cpuinfo.proto s390:proto: Add s390 to protocol buffer files 2017-08-09 18:51:41 +03:00
creds.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
eventfd.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
eventpoll.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
ext-file.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
fdinfo.proto files: Move CTL_TTY_OFF fixup to generic file engine 2017-12-28 20:02:50 +03:00
fh.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
fifo.proto fifo: Generate unique ID for satellite regfile entry 2017-10-17 11:41:50 +03:00
file-lock.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
fown.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
fs.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
fsnotify.proto fsnotify: don't save mnt_id if a mount namepsace isn't dumped 2017-05-19 09:33:02 +03:00
ghost-file.proto ghost: Add chunked ghost files 2017-07-18 09:34:44 +03:00
inventory.proto inventory: save uptime to know when dump had happened 2018-04-27 01:04:15 +03:00
ipc-desc.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
ipc-msg.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
ipc-sem.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
ipc-shm.proto ipc: Keep shmem segments contents into pagemap/page images 2017-04-11 09:01:10 +03:00
ipc-var.proto ipc/sysctl: c/r kernel.{msg_next_id,sem_next_id,shm_next_id} 2016-09-06 18:58:26 +03:00
macvlan.proto images: add syntax declaration to macvlan.proto 2016-11-03 18:15:02 +03:00
Makefile images: Move uid_gid_extent and userns_entry descriptions 2017-11-30 01:22:14 +03:00
mm.proto mem: add dump state of THP_DISABLED prctl 2017-09-16 12:30:22 +03:00
mnt.proto mount: save ext_real_root for external mounts 2017-04-02 18:12:10 +03:00
netdev.proto net: dump and restore connected to a bridge links 2017-11-30 01:22:16 +03:00
ns.proto crit: Show CLONE_ flags in ns image 2017-11-30 01:31:19 +03:00
opts.proto crit: Beautify unix names recode 2017-04-11 09:01:11 +03:00
packet-sock.proto net: save network namespaces for sockets 2017-11-30 01:18:53 +03:00
pagemap.proto crit: translate pagemap flags into strings 2017-09-16 09:16:33 +03:00
pipe-data.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
pipe.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
pstree.proto images: Add NSpids pstree descriptions 2017-11-30 01:24:30 +03:00
regfile.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
remap-file-path.proto images: remap-file-path -- Reserve entries for spfs manager 2017-11-30 01:22:15 +03:00
remote-image.proto images: add proto2 syntax specification to remote-image.proto 2017-11-30 01:22:15 +03:00
rlimit.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
rpc.proto service: allow to execute page-server as a child process 2017-11-23 20:23:23 +03:00
sa.proto restore/x86: call int80 for compat sigaction restore 2017-03-14 23:58:06 +03:00
seccomp.proto seccomp: Fetch seccomp flags if kernel provides 2018-05-15 03:51:16 +03:00
siginfo.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
signalfd.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
sit.proto net: Dump regular sit device 2017-10-17 10:48:46 +03:00
sk-inet.proto images: sk-inet -- Reserve entries for IP raw sockets 2017-11-30 01:22:15 +03:00
sk-netlink.proto images: sk-netlink -- Reserve entries for netlink queued messages 2017-11-30 01:22:15 +03:00
sk-opts.proto sk-inet: restore a value of SO_REUSEPORT 2017-11-23 20:23:14 +03:00
sk-packet.proto images: sk-packet -- Reserve entries for ucreds messages 2017-11-30 01:22:15 +03:00
sk-unix.proto unix: restore sockets on correct mount points 2018-03-23 00:51:37 +03:00
stats.proto stats: save uptime to know when dump had happened 2018-02-28 22:57:30 +03:00
sysctl.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
tcp-stream.proto tcp: dump and restore window parameters 2016-08-08 15:20:47 +03:00
time.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
timer.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
timerfd.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
tty.proto images: tty -- Reserve entries for multiple devpts support 2017-11-30 01:22:15 +03:00
tun.proto net: Dump tun device net id in img 2018-03-16 08:41:17 +03:00
utsns.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00
vma.proto Add missing "proto2" syntax marker 2016-07-07 12:38:39 +03:00