Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
😊

Masami Ichikawa masami256

😎
😊
View GitHub Profile
View Makefile
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 Jun 5, 2018
AWSのコマンドラインインターフェースで2段階認証を使うための便利ツール
View setup_aws_mfa.sh
#!/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
View read_vdso.c
#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 Nov 26, 2017
for linux advent calendar 2017
View slmb.svg
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 Sep 24, 2017
show memory usage in memcg.
View memcgstat.py
#!/usr/bin/env python3
import argparse
import os
import sys
import time
import signal
def sigint_handler(signalnum, handler):
sys.exit(0)
View refcounter_test.c
#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");
View 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 Jul 16, 2016
livepatch test module
View livetest.c
#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>
View Dockerfile
# 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 Apr 29, 2016
Show pid in each pid namespaces
View pid.stp
#!/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;