diff --git a/4.14.8/examples/chardev.c b/4.14.8/examples/chardev.c index 36580c4..98bfd87 100644 --- a/4.14.8/examples/chardev.c +++ b/4.14.8/examples/chardev.c @@ -16,6 +16,8 @@ #include #include +MODULE_LICENSE("GPL"); + /* * Prototypes - this would normally go in a .h file */ diff --git a/4.14.8/examples/chardev2.c b/4.14.8/examples/chardev2.c index 55917e4..cc5bff9 100644 --- a/4.14.8/examples/chardev2.c +++ b/4.14.8/examples/chardev2.c @@ -15,6 +15,8 @@ #include #include +MODULE_LICENSE("GPL"); + #include "chardev.h" #define SUCCESS 0 #define DEVICE_NAME "char_dev" diff --git a/4.14.8/examples/syscall.c b/4.14.8/examples/syscall.c index 16222c5..ccb901c 100644 --- a/4.14.8/examples/syscall.c +++ b/4.14.8/examples/syscall.c @@ -25,7 +25,7 @@ #include #include -unsigned long **sys_call_table; +sys_call_ptr_t *sys_call_table_ptr; unsigned long original_cr0; /* @@ -87,15 +87,18 @@ asmlinkage int our_sys_open(const char *filename, int flags, int mode) return original_call(filename, flags, mode); } -static unsigned long **aquire_sys_call_table(void) +static sys_call_ptr_t *aquire_sys_call_table(void) { unsigned long int offset = PAGE_OFFSET; - unsigned long **sct; + /* unsigned long **sct; */ + sys_call_ptr_t *sct; while (offset < ULLONG_MAX) { - sct = (unsigned long **)offset; + /* sct = (unsigned long **)offset; */ + sct = (sys_call_ptr_t *)offset; - if (sct[__NR_close] == (unsigned long *) sys_close) + /* if (sct[__NR_close] == (unsigned long *) sys_close) */ + if (sct[__NR_close] == (sys_call_ptr_t) sys_close) return sct; offset += sizeof(void *); @@ -106,7 +109,7 @@ static unsigned long **aquire_sys_call_table(void) static int __init syscall_start(void) { - if(!(sys_call_table = aquire_sys_call_table())) + if(!(sys_call_table_ptr = aquire_sys_call_table())) return -1; original_cr0 = read_cr0(); @@ -114,10 +117,10 @@ static int __init syscall_start(void) write_cr0(original_cr0 & ~0x00010000); /* keep track of the original open function */ - original_call = (void*)sys_call_table[__NR_open]; + original_call = (void*)sys_call_table_ptr[__NR_open]; /* use our open function instead */ - sys_call_table[__NR_open] = (unsigned long *)our_sys_open; + sys_call_table_ptr[__NR_open] = (sys_call_ptr_t)our_sys_open; write_cr0(original_cr0); @@ -128,14 +131,14 @@ static int __init syscall_start(void) static void __exit syscall_end(void) { - if(!sys_call_table) { + if(!sys_call_table_ptr) { return; } /* * Return the system call back to normal */ - if (sys_call_table[__NR_open] != (unsigned long *)our_sys_open) { + if (sys_call_table_ptr[__NR_open] != (sys_call_ptr_t) our_sys_open) { pr_alert("Somebody else also played with the "); pr_alert("open system call\n"); pr_alert("The system may be left in "); @@ -143,7 +146,7 @@ static void __exit syscall_end(void) } write_cr0(original_cr0 & ~0x00010000); - sys_call_table[__NR_open] = (unsigned long *)original_call; + sys_call_table_ptr[__NR_open] = (sys_call_ptr_t)original_call; write_cr0(original_cr0); msleep(2000);