Skip to content

Instantly share code, notes, and snippets.

View masami256's full-sized avatar
😎
😊

Masami Ichikawa masami256

😎
😊
View GitHub Profile
@masami256
masami256 / Makefile
Last active March 8, 2020 05:50
uname hacks
KERNDIR := /lib/modules/`uname -r`/build
BUILD_DIR := $(shell pwd)
VERBOSE = 0
obj-m := uname-livepatch.o
smallmod-objs := uname-livepatch.o
all:
make -C $(KERNDIR) M=$(BUILD_DIR) KBUILD_VERBOSE=$(VERBOSE) modules
@masami256
masami256 / setup_aws_mfa.sh
Created June 5, 2018 06:15
AWSのコマンドラインインターフェースで2段階認証を使うための便利ツール
#!/bin/bash
# Before run this script, get authengication token via google authenticator app or other tool
if [ $# != 1 ]; then
echo "usage: $0 [token]"
exit 1
fi
tokencode=$1
@masami256
masami256 / read_vdso.c
Created March 19, 2018 15:20
dump vdso
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/auxv.h>
#include <unistd.h>
static void *find_vdso_start_address(void)
{
return (void *) getauxval(AT_SYSINFO_EHDR);
}
@masami256
masami256 / slmb.svg
Last active November 26, 2017 03:10
for linux advent calendar 2017
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@masami256
masami256 / memcgstat.py
Created September 24, 2017 11:11
show memory usage in memcg.
#!/usr/bin/env python3
import argparse
import os
import sys
import time
import signal
def sigint_handler(signalnum, handler):
sys.exit(0)
@masami256
masami256 / refcounter_test.c
Created May 3, 2017 10:21
refcount api test
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/refcount.h>
#include <linux/smp.h>
#include <linux/slab.h>
MODULE_DESCRIPTION("refcount api test");
MODULE_AUTHOR("masami256");
@masami256
masami256 / codename.patch
Created February 11, 2017 14:07
codename patch
diff --git a/Makefile b/Makefile
index 8e223e0..9f4bd0c 100644
--- a/Makefile
+++ b/Makefile
@@ -1024,6 +1024,7 @@ endif
prepare2: prepare3 prepare-compiler-check outputmakefile asm-generic
prepare1: prepare2 $(version_h) include/generated/utsrelease.h \
+ include/generated/utscodename.h \
include/config/auto.conf
@masami256
masami256 / livetest.c
Created July 16, 2016 02:42
livepatch test module
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/livepatch.h>
#include <linux/seq_file.h>
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/pid_namespace.h>
# Use centos
FROM centos:centos7
MAINTAINER masami256@gmail.com
COPY mysql57-community-release-el7-8.noarch.rpm /tmp/
COPY make_netmask.sh /tmp/
RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \
yum localinstall -y /tmp/mysql57-community-release-el7-8.noarch.rpm && \
yum update -y && \
@masami256
masami256 / pid.stp
Created April 29, 2016 14:10
Show pid in each pid namespaces
#!/usr/bin/env stap
%{
#include <linux/sched.h>
#include <linux/thread_info.h>
#include <linux/pid_namespace.h>
%}
function show_pidtree:long(pn:long) %{
struct task_struct *task;