Skip to content

Instantly share code, notes, and snippets.

View masami256's full-sized avatar
😎
😊

Masami Ichikawa masami256

😎
😊
View GitHub Profile
@masami256
masami256 / cve-2024-50257.c
Created November 25, 2024 14:48
cve-2024-50257.c
// gcc cve-2024-50257.c -lpthread
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <pthread.h>
#include <fcntl.h>
@masami256
masami256 / count_cwe.py
Last active November 24, 2024 04:40
Get Linux kernel CVEs and its CWE
#!/usr/bin/env python
import json
import sys
def main(jsonfile):
with open(jsonfile) as f:
all_data = json.loads(f.read())
cve_data = {}
@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
Loading
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>