apt install -y systemtap
stap-prep
Please install linux-headers-4.4.0-104-genericYou need package linux-image-4.4.0-104-generic-dbgsym but it does not seem to be availableUbuntu -dbgsym packages are typically in a separate repositoryFollow https://wiki.ubuntu.com/DebuggingProgramCrash to add this repositoryapt install -y linux-headers-4.4.0-104-generic
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C8CAB6595FDFF622codename=$(lsb_release -c | awk '{print $2}')sudo tee /etc/apt/sources.list.d/ddebs.list << EOFdeb http://ddebs.ubuntu.com/ ${codename} main restricted universe multiversedeb http://ddebs.ubuntu.com/ ${codename}-security main restricted universe multiversedeb http://ddebs.ubuntu.com/ ${codename}-updates main restricted universe multiversedeb http://ddebs.ubuntu.com/ ${codename}-proposed main restricted universe multiverseEOFsudo apt-get update
stap-prep
Please install linux-headers-4.4.0-104-genericPlease install linux-image-4.4.0-104-generic-dbgsym
apt install -y linux-image-4.4.0-104-generic-dbgsym
apt install -y linux-headers-4.4.0-104-generic
yum install -y systemtap
debuginfo is not added. Add the following to /etc/yum.repos.d/CentOS-Debug.repo and save.[debuginfo]name=CentOS-$releasever - DebugInfobaseurl=http://debuginfo.centos.org/$releasever/$basearch/gpgcheck=0enabled=1protect=1priority=1
kernel-debuginfo.stap-prep
kernel-devel installed:rpm -qa | grep kernel-devel
kernel-devel-3.10.0-327.el7.x86_64kernel-devel-3.10.0-514.26.2.el7.x86_64kernel-devel-3.10.0-862.9.1.el7.x86_64
3.10.0-862.9.1.el7.x86_64, delete all version except kernel-devel-3.10.0-862.9.1.el7.x86_64.uname -r to view the kernel version. kernel-debuginfo and kernel-devel are both installed and their versions correspond to the kernel version.rpm -e kernel-devel-3.10.0-327.el7.x86_64 kernel-devel-3.10.0-514.26.2.el7.x86_64
modprobe to load the module into the kernel.kubectl describe pod <pod name>
......Container ID: docker://5fb8adf9ee62afc6d3f6f3d9590041818750b392dff015d7091eaaf99cf1c945......Last State: TerminatedReason: ErrorExit Code: 137Started: Thu, 05 Sep 2019 19:22:30 +0800Finished: Thu, 05 Sep 2019 19:33:44 +0800
docker inspect -f "{{.State.Pid}}" 5fb8adf9ee62afc6d3f6f3d9590041818750b392dff015d7091eaaf99cf1c945
7942
Exit Code in the result of Step 1 to obtain the status code of the last container exit. For the purpose of this article, we will use 137 as an example. The analysis is as follows:SIGKILL. However, we still cannot determine the reason why the process exited.sg.stp. Add the following content and save.global target_pid = 7942probe signal.send{if (sig_pid == target_pid) {printf("%s(%d) send %s to %s(%d)\\n", execname(), pid(), sig_name, pid_name, sig_pid);printf("parent of sender: %s(%d)\\n", pexecname(), ppid())printf("task_ancestry:%s\\n", task_ancestry(pid2task(pid()), 1));}}
pid with the value of the main container process pid obtained in Step 2. For the purpose of this article, we will use 7942 as an example:stap sg.stp
pkill(23549) send SIGKILL to server(7942)parent of sender: bash(23495)task_ancestry:swapper/0(0m0.000000000s)=>systemd(0m0.080000000s)=>vGhyM0(19491m2.579563677s)=>sh(33473m38.074571885s)=>bash(33473m38.077072025s)=>bash(33473m38.081028267s)=>bash(33475m4.817798337s)=>pkill(33475m5.202486630s)
task_ancestry, you can see the parent processes of the stopped process. In the example above, you can see a strange process called vGhyM0. This usually indicates that there is a trojan in the system. Take the necessary steps to clean it so your containers can function properly.Feedback