This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.section .data | |
potato: | |
.byte 65, 66, 10 | |
.section .text | |
.globl _start | |
_start: | |
movq $1, %rbx | |
movq $potato, %rcx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <errno.h> | |
#include <fcntl.h> | |
#include <pthread.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <sys/ioctl.h> | |
#include <sys/stat.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import bcc | |
import collections | |
import ctypes | |
import functools | |
import sys | |
bpf_text = r""" | |
#include <uapi/linux/ptrace.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Prototype implementation of x86-64 page table walking in drgn. Doesn't handle | |
huge pages or 5-level page tables. Probably wrong in other ways. | |
""" | |
from drgn import cast, reinterpret | |
from drgn.helpers.linux.mm import page_to_virt, pfn_to_page | |
def pgd_val(pgd): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <fcntl.h> | |
#include <sched.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/wait.h> | |
static const int NUM_KEEP = 5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ drgn | |
... | |
>>> for cpu in for_each_present_cpu(): | |
... task = per_cpu(prog["runqueues"], cpu).idle | |
... print(task.comm, task.pid) | |
... | |
(char [16])"swapper/0" (pid_t)0 | |
(char [16])"swapper/1" (pid_t)0 | |
(char [16])"swapper/2" (pid_t)0 | |
(char [16])"swapper/3" (pid_t)0 |