readme.txt 1.19 KB
Newer Older
1
2
3
4
1. install ubuntu 22.04  5.15.0-25
2. apt-get install build-essential flex libncurses-dev linux-headers-generic linux-source libssl-dev bison yacc vim libelf-dev  ...... and so on
3. cp /lib/modules/5.15.0-25-generic/build/Module.symvers ./
4. /boot/config-5.15.0-25-generic as .config   make oldconfig
longpanda's avatar
longpanda committed
5
6
7
5. make menuconfig 
    1. close CONFIG_STACKPROTECTOR
    2. close CONFIG_RETPOLINE
8
9
    3. close CONFIG_UBSAN_BOUNDS
    4. close CONFIG_UBSAN_ENUM
longpanda's avatar
longpanda committed
10
11
12
13

6. modify ./scripts/mod/modpost.c
    1. skip add_srcversion (just return)
    2. force add_retpoline (#ifdef --> #ifndef)
longpanda's avatar
longpanda committed
14
    3. force add_intree_flag
longpanda's avatar
longpanda committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

7. make modules_prepare LOCALVERSION=-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

8. Append padding at the end of struct module <include/linux/module.h>
struct module {
    enum module_state state;

	/* Member of list of modules */
	struct list_head list;

	/* Unique handle for this module */
	char name[MODULE_NAME_LEN];
    
    ....
    
    char padding[1024];
};

This is because struct module size is different in different kernel versions or with different CONFIG item.


9. make modules M=/home/dmpatch
10. strip --strip-debug /home/dmpatch/dm_patch.ko