Skip to content

Latest commit

 

History

History
100 lines (79 loc) · 2.6 KB

File metadata and controls

100 lines (79 loc) · 2.6 KB

pstree-fork

Prerequisites

Version
Architecture x86_64
Kernel 5.4.210
OS Debian GNU/Linux 10 (buster)

Usage

Install dependencies

apt-get update --allow-releaseinfo-change -y
apt-get upgrade -y
apt-get install -y $(cat debian-packages.txt)

Install kernel

  • If you do not want to compile the kernel, please use installation package in pstree-fork-kernel/deb.

  • Build the linux kernel (if required):

  1. get linux v5.4.210
git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
cd linux
git reset --hard v5.4.210
  1. cp pstree-fork-kernel/patches to linux
  2. apply patches and install new kernel
git am patches/*
make menuconfig

commitid=`git rev-parse --short HEAD`
r="5.4.210.bsk.$commitid"
v="5.4.210.bsk.$commitid"
t="Debian $v $(date +\(%F\))"
make bindeb-pkg -j`nproc` KERNELRELEASE=$r KDEB_PKGVERSION=$v KBUILD_BUILD_VERSION_TIMESTAMP="$t"

cd ../
dpkg -i *deb

# reboot -f

Compile pstree-fork

$ cd pstree-fork
$ make -j
$ ./pstree-fork -h
Usage: ./pstree-fork [ht:d:i:es:l:c]

Options:
  -h|--help		show help text
  -t|--template-pid	leading pid of template process tree
  -d|--dst-ppid	parent pid of newly forked process tree
  -i|--inherit-fd fd[num]:RES
			Inherit file descriptors, treating fd NUM as being
			already opened via an existing RES, which can be:
			    pipe[inode]
			    file[mnt_id:inode]
			    path/to/file
  -e|--external-tcp	reconnect to external tcp server automatically
  -s|--sock-path	the unix domain socket path of pstree-fork server
  -l|--log-level	set max log level:
			    0 NOLOG
			    1 ERR
			    2 WARN
			    3 INFO
			    4 DEBUG
  -c|--checker		sanity check to ensure pstree-fork successfully

If you want details about usage scenarios, try the test script tests/run.sh in the next section.

Tests

  • Our test case opens a large number of fds, so adjusts the system limits to avoid too many open files error.
ulimit -n 65535
  • run tests
cd tests

./run.sh caps00 # name of testcases in `static`

./run_all.sh -j 200 # Test all cases concurrently, with the results stored in the "output" folder

Acknowledgement

Part of the code is based on the CRIU project.