Skip to content

Instantly share code, notes, and snippets.

@avagin
avagin / gist:7336ccb5e1026e27168e
Created May 8, 2015 14:15
libcontainer tests for libct
[root@avagin-fc19-cr libcontainer]# make integration
make -C integration
make[1]: Entering directory '/root/git/libcontainer/integration'
go test -bench . -v --tags libct .
=== RUN TestExecPS
--- PASS: TestExecPS (0.07s)
=== RUN TestUsernsExecPS
--- PASS: TestUsernsExecPS (0.38s)
=== RUN TestIPCPrivate
--- PASS: TestIPCPrivate (0.37s)
ip-18216 [001] .... 2890740.113215: netlink_unicast <-netlink_sendmsg
ip-18216 [001] .... 2890740.113217: rtnetlink_rcv <-netlink_unicast
ip-18216 [001] .... 2890740.113218: rtnetlink_rcv_msg <-netlink_rcv_skb
ip-18216 [001] .... 2890740.113218: rtnl_newlink <-rtnetlink_rcv_msg
ip-18216 [001] .... 2890740.113220: netlink_ack <-netlink_rcv_skb
ip-18216 [001] .... 2890740.113220: netlink_alloc_skb <-netlink_ack
ip-18216 [001] .... 2890740.113222: netlink_unicast <-netlink_ack
8568 ? Ssl 19:04 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr
@avagin
avagin / gist:b40fbc224a62aa5ee8eb
Created March 12, 2015 21:12
go test vs pipes
[avagin@localhost ~]$ cat test_test.go
package main
import "time"
import "testing"
import "bufio"
import "fmt"
import "os"
func asd() {
@avagin
avagin / gist:de5c788a8551c9b89450
Created February 26, 2015 09:10
show locks in fdinfo
diff --git a/fs/locks.c b/fs/locks.c
index 59e2f90..ebbf686 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2563,6 +2563,27 @@ static int locks_show(struct seq_file *f, void *v)
return 0;
}
+void show_fd_locks(struct seq_file *f, struct file *filp)
+{
root@ubuntu:/home/avagin/git/api/libcontainer# cat /proc/6233/mountinfo
101 71 8:1 /tmp/939768661 / rw,relatime - ext4 /dev/disk/by-uuid/291e7b1a-8396-44cf-9927-578b3401d0bd rw,errors=remount-ro,data=ordered
102 101 0:36 / /proc rw,nosuid,nodev,noexec,relatime - proc proc rw
103 101 0:37 / /dev rw,nosuid,nodev - tmpfs tmpfs rw,mode=755
104 103 0:38 / /dev/shm rw,nosuid,nodev,noexec,relatime - tmpfs shm rw,size=65536k
105 103 0:35 / /dev/mqueue rw,nosuid,nodev,noexec,relatime - mqueue mqueue rw
106 103 0:39 / /dev/pts rw,nosuid,noexec,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=666
107 101 0:40 / /sys rw,nosuid,nodev,noexec,relatime - sysfs sysfs rw
https://lkml.org/lkml/2014/8/13/746
@avagin
avagin / gist:4c494d528923f16511f1
Last active August 29, 2015 14:14
*** longjmp causes uninitialized stack frame ***: nsenter-exec terminated
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
#include <sched.h>
#include <signal.h>
struct cr_clone_arg {
char stack[4096] __attribute__((aligned (8)));
char stack_ptr[0];
@avagin
avagin / gist:1dd567a066df7993ee33
Last active August 29, 2015 14:06
restore: change a stage before resuming tasks
criu-6238 2672.213515: sys_futex(uaddr: 7f35bc631010, op:|
criu-6238 2672.213543: sys_futex -> 0x0 |
...
env00-6220 2672.213594: sys_futex | env00-5863 2501.582665: sys_futex
| criu-5881 2501.582739: sys_futex
| criu-5881 2501.582791: sys_futex -> 0x1
env00-6220 2672.213596: sys_futex -> 0xfffffffffffffff5 | env00-5863 2501.582810: sys_futex -> 0x0
[root@avagin-fc19-cr criu]# bash test/zdtm.sh static/inotify00
================================= CRIU CHECK =================================
Looks good.
Execute zdtm/live/static/inotify00
cc -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -iquote ../../lib/arch/x86/include -I../../lib inotify00.c ../../lib/libzdtmtst.a -o inotify00
./inotify00 --pidfile=inotify00.pid --outfile=inotify00.out
Dump 1097
Restore
Check results 1097
Waiting...
[272611.974820] ------------[ cut here ]------------
[272611.975039] kernel BUG at kernel/auditsc.c:1454!
[272611.975039] invalid opcode: 0000 [#1] SMP
[272611.975039] Modules linked in: veth binfmt_misc ip6table_filter ip6_tables tun netlink_diag af_packet_diag udp_diag tcp_diag inet_diag unix_diag bridge stp llc btrf
[272611.975039] CPU: 1 PID: 32682 Comm: ip Not tainted 3.14.0-00365-g3a6fad4 #178
[272611.975039] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
[272611.975039] task: ffff880043d08000 ti: ffff8800cfb46000 task.ti: ffff8800cfb46000
[272611.975039] RIP: 0010:[<ffffffff8113de1a>] [<ffffffff8113de1a>] __audit_syscall_entry+0xea/0x100
[272611.975039] RSP: 0018:ffff8800cfb47f08 EFLAGS: 00010202
[272611.975039] RAX: 0000000000000001 RBX: ffff88004b50e458 RCX: 0000000000000000
@avagin
avagin / gist:9838890
Created March 28, 2014 17:55
nf_ct_gre_keymap_flush
<idle>-0 [001] ..s. 6791.694079: nf_ct_gre_keymap_add <-exp_gre
<idle>-0 [001] ..s. 6791.694105: nf_ct_gre_keymap_add <-exp_gre
kworker/u4:3-48 [001] .... 6821.554100: nf_conntrack_pptp_net_exit <-ops_exit_list.isra.1
kworker/u4:3-48 [001] .... 6821.554102: nf_ct_gre_keymap_flush <-nf_conntrack_pptp_net_exit
kworker/u4:3-48 [001] .... 6821.554105: proto_gre_net_exit <-ops_exit_list.isra.1
kworker/u4:3-48 [001] .... 6821.554105: nf_ct_l4proto_pernet_unregister <-proto_gre_net_exit
kworker/u4:3-48 [001] .... 6821.554106: nf_ct_iterate_cleanup <-nf_ct_l4proto_pernet_unregister
kworker/u4:3-48 [001] .... 6821.554169: nf_ct_gre_keymap_destroy <-gre_destroy
kworker/u4:3-48 [001] .... 6821.679711: nf_ct_gre_keymap_flush <-proto_gre_net_exit
kworker/u4:3-48 [001] .... 6821.679718: nf_ct_iterate_cleanup <-nf_ct_l3proto_pernet_unregister