鏇存柊浜嗗唴瀛樼鐞嗕箣椤靛紡绠$悊鏈哄埗...

This commit is contained in:
gatieme
2016-08-07 16:35:13 +08:00
parent 0a5d402edf
commit 212a9fac6e
59 changed files with 686 additions and 686 deletions
@@ -1,69 +1,69 @@
# ------------------------------------------------------------------------------
#
# Makefile for the LDD-LinuxDeviceDrivers print_task.
#
# Author: gatieme
# Create: 2016-07-29 15:50:46
# Last modified: 2016-07-29 16:10:29
# Description:
# This program is loaded as a kernel(v2.6.18 or later) module.
# Use "make install" to load it into kernel.
# Use "make remove" to remove the module out of kernel.
#
# ------------------------------------------------------------------------------
ROOT=..
#PLATFORM=$(shell $(ROOT)/systype.sh)
#include $(ROOT)/Make.defines.$(PLATFORM)
MODULE_NAME := print_task
ifneq ($(KERNELRELEASE),)
#CFG_FLAGS += -O2 -I./
#EXTRA_CFLAGS += $(C_FLAGS) $(CFG_INC) $(CFG_INC)
obj-m := $(MODULE_NAME).o #print_task.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
make -C $(KERNELDIR) M=$(PWD) modules
modules_install:
make -C $(KERNELDIR) M=$(PWD) modules_install
insmod:
sudo insmod $(MODULE_NAME).ko
reinsmod:
sudo rmmod $(MODULE_NAME)
sudo insmod $(MODULE_NAME).ko
github:
cd $(ROOT) && make github
rmmod:
sudo rmmod $(MODULE_NAME)
test :
sudo ../injector/memInjector -l stack -m random -t word_0 --time 1 --timeout 3 -p 1
clean:
make -C $(KERNELDIR) M=$(PWD) clean
rm -f modules.order Module.symvers Module.markers
.PHNOY:
modules modules_install clean
endif
# ------------------------------------------------------------------------------
#
# Makefile for the LDD-LinuxDeviceDrivers print_task.
#
# Author: gatieme
# Create: 2016-07-29 15:50:46
# Last modified: 2016-07-29 16:10:29
# Description:
# This program is loaded as a kernel(v2.6.18 or later) module.
# Use "make install" to load it into kernel.
# Use "make remove" to remove the module out of kernel.
#
# ------------------------------------------------------------------------------
ROOT=..
#PLATFORM=$(shell $(ROOT)/systype.sh)
#include $(ROOT)/Make.defines.$(PLATFORM)
MODULE_NAME := print_task
ifneq ($(KERNELRELEASE),)
#CFG_FLAGS += -O2 -I./
#EXTRA_CFLAGS += $(C_FLAGS) $(CFG_INC) $(CFG_INC)
obj-m := $(MODULE_NAME).o #print_task.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
make -C $(KERNELDIR) M=$(PWD) modules
modules_install:
make -C $(KERNELDIR) M=$(PWD) modules_install
insmod:
sudo insmod $(MODULE_NAME).ko
reinsmod:
sudo rmmod $(MODULE_NAME)
sudo insmod $(MODULE_NAME).ko
github:
cd $(ROOT) && make github
rmmod:
sudo rmmod $(MODULE_NAME)
test :
sudo ../injector/memInjector -l stack -m random -t word_0 --time 1 --timeout 3 -p 1
clean:
make -C $(KERNELDIR) M=$(PWD) clean
rm -f modules.order Module.symvers Module.markers
.PHNOY:
modules modules_install clean
endif
@@ -1,67 +1,67 @@
# Makefile for the memory fault injection engine.
#
# Author: gatieme
# Create: 2016-07-29 15:50:46
# Last modified: 2016-07-29 16:10:29
# Description:
# This program is loaded as a kernel(v2.6.18 or later) module.
# Use "make install" to load it into kernel.
# Use "make remove" to remove the module out of kernel.
#
ROOT=..
#PLATFORM=$(shell $(ROOT)/systype.sh)
#include $(ROOT)/Make.defines.$(PLATFORM)
MODULE_NAME := print_vmarea
ifneq ($(KERNELRELEASE),)
#CFG_FLAGS += -O2 -I./
#EXTRA_CFLAGS += $(C_FLAGS) $(CFG_INC) $(CFG_INC)
obj-m := $(MODULE_NAME).o #print_vmarea.o
else
#MODULE_NAME := print_vmarea
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
#KERNELDIR ?= /home/gatieme/Work/Kernel/
PWD := $(shell pwd)
modules:
make -C $(KERNELDIR) M=$(PWD) modules
modules_install:
make -C $(KERNELDIR) M=$(PWD) modules_install
insmod:
sudo insmod $(MODULE_NAME).ko
reinsmod:
sudo rmmod $(MODULE_NAME)
sudo insmod $(MODULE_NAME).ko
github:
cd $(ROOT) && make github
rmmod:
sudo rmmod $(MODULE_NAME)
test :
sudo ../injector/memInjector -l stack -m random -t word_0 --time 1 --timeout 3 -p 1
clean:
make -C $(KERNELDIR) M=$(PWD) clean
rm -f modules.order Module.symvers Module.markers
.PHNOY:
modules modules_install clean
endif
# Makefile for the memory fault injection engine.
#
# Author: gatieme
# Create: 2016-07-29 15:50:46
# Last modified: 2016-07-29 16:10:29
# Description:
# This program is loaded as a kernel(v2.6.18 or later) module.
# Use "make install" to load it into kernel.
# Use "make remove" to remove the module out of kernel.
#
ROOT=..
#PLATFORM=$(shell $(ROOT)/systype.sh)
#include $(ROOT)/Make.defines.$(PLATFORM)
MODULE_NAME := print_vmarea
ifneq ($(KERNELRELEASE),)
#CFG_FLAGS += -O2 -I./
#EXTRA_CFLAGS += $(C_FLAGS) $(CFG_INC) $(CFG_INC)
obj-m := $(MODULE_NAME).o #print_vmarea.o
else
#MODULE_NAME := print_vmarea
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
#KERNELDIR ?= /home/gatieme/Work/Kernel/
PWD := $(shell pwd)
modules:
make -C $(KERNELDIR) M=$(PWD) modules
modules_install:
make -C $(KERNELDIR) M=$(PWD) modules_install
insmod:
sudo insmod $(MODULE_NAME).ko
reinsmod:
sudo rmmod $(MODULE_NAME)
sudo insmod $(MODULE_NAME).ko
github:
cd $(ROOT) && make github
rmmod:
sudo rmmod $(MODULE_NAME)
test :
sudo ../injector/memInjector -l stack -m random -t word_0 --time 1 --timeout 3 -p 1
clean:
make -C $(KERNELDIR) M=$(PWD) clean
rm -f modules.order Module.symvers Module.markers
.PHNOY:
modules modules_install clean
endif
@@ -1,31 +1,31 @@
//#include <asm/system.h>
#include <linux/mm.h>
#include <linux/mm_types.h>
#include <linux/sched.h>
#include <linux/types.h>
static unsigned long read_pgd(void)
{
return (unsigned long)current->mm->pgd;
}
static int __init init_cr3_pgd(void)
{
unsigned long cr3;
unsigned long pgd = 0;
cr3 = read_cr3();
printk("cr3----------------->0x%lx\n", cr3);
pgd = __pa(read_pgd());
printk("pgd----------------->0x%lx\n", pgd);
return 0;
}
static void __exit exit_cr3_pgd(void)
{
printk("--------------------->exit!\n");
return ;
}
module_init(init_cr3_pgd);
module_exit(exit_cr3_pgd);
//#include <asm/system.h>
#include <linux/mm.h>
#include <linux/mm_types.h>
#include <linux/sched.h>
#include <linux/types.h>
static unsigned long read_pgd(void)
{
return (unsigned long)current->mm->pgd;
}
static int __init init_cr3_pgd(void)
{
unsigned long cr3;
unsigned long pgd = 0;
cr3 = read_cr3();
printk("cr3----------------->0x%lx\n", cr3);
pgd = __pa(read_pgd());
printk("pgd----------------->0x%lx\n", pgd);
return 0;
}
static void __exit exit_cr3_pgd(void)
{
printk("--------------------->exit!\n");
return ;
}
module_init(init_cr3_pgd);
module_exit(exit_cr3_pgd);

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

@@ -1,45 +1,45 @@
/*****************************************************************
mem.c
pid PID
va
*****************************************************************/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <asm/pgtable.h>
#include <asm/page.h>
MODULE_LICENSE("GPL");
static unsigned long VA;
module_param(VA, ulong, 0644);
static int __init kv2p_init(void)
{
int value = 10;
// use virt_to_phys
// http://lxr.free-electrons.com/source/arch/arm64/include/asm/memory.h?v4.7#L189
phys_addr_t phyaddr = virt_to_phys((const volatile void *)&value);
printk("0x%lx\n", (unsigned long )phyaddr);
return 0;
}
static void __exit kv2p_exit(void)
{
printk(KERN_INFO"Goodbye!\n");
}
module_init(kv2p_init);
module_exit(kv2p_exit);
/*****************************************************************
mem.c
pid PID
va
*****************************************************************/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <asm/pgtable.h>
#include <asm/page.h>
MODULE_LICENSE("GPL");
static unsigned long VA;
module_param(VA, ulong, 0644);
static int __init kv2p_init(void)
{
int value = 10;
// use virt_to_phys
// http://lxr.free-electrons.com/source/arch/arm64/include/asm/memory.h?v4.7#L189
phys_addr_t phyaddr = virt_to_phys((const volatile void *)&value);
printk("0x%lx\n", (unsigned long )phyaddr);
return 0;
}
static void __exit kv2p_exit(void)
{
printk(KERN_INFO"Goodbye!\n");
}
module_init(kv2p_init);
module_exit(kv2p_exit);

Some files were not shown because too many files have changed in this diff Show More