This repository was archived by the owner on Oct 12, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
76 lines (68 loc) · 1.94 KB
/
Copy pathmain.cpp
File metadata and controls
76 lines (68 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "ElfModify.h"
// disagrees about version of symbol module_layout
//// include/linux/sysfs.h:30
//struct attribute {
// const char *name;
//// umode_t mode;
//#ifdef CONFIG_DEBUG_LOCK_ALLOC
// bool ignore_lockdep:1;
// struct lock_class_key *key;
// struct lock_class_key skey;
//#endif
//};
//// include/linux/module.h:52
//struct module_attribute {
// struct attribute attr;
//// ssize_t (*show)(struct module_attribute *, struct module_kobject *, char *);
//// ssize_t (*store)(struct module_attribute *, struct module_kobject *, const char *, size_t count);
//// void (*setup)(struct module *, const char *);
//// int (*test)(struct module *);
//// void (*free)(struct module *);
// void *show;
// void *store;
// void *setup;
// void *test;
// void *free;
//};
//// kernel/module/internal.h:57
//struct load_info {
// const char *name;
// /* pointer to module in temporary copy, freed at end of load_module() */
// struct module *mod;
// Elf64_Ehdr *hdr;
// unsigned long len;
// Elf64_Shdr *sechdrs;
// char *secstrings, *strtab;
// unsigned long symoffs, stroffs, init_typeoffs, core_typeoffs;
//// struct _ddebug_info dyndbg;
// bool sig_ok;
//#ifdef CONFIG_KALLSYMS
// unsigned long mod_kallsyms_init_off;
//#endif
//#ifdef CONFIG_MODULE_DECOMPRESS
// struct page **pages;
// unsigned int max_pages;
// unsigned int used_pages;
//#endif
// struct {
// unsigned int
// sym, /*.symtab*/
// str,
// mod, /*.gnu.linkonce.this_module */
// vers, /*__versions*/
// info, /*.modinfo*/
// pcpu;
// } index;
//};
// argv[1] = 符号表文件
// argv[2] = 内核模块文件
int main(int argc, char **argv)
{
if(argc < 3) return -1;
ElfModify m(argv[1],argv[2]);
if(argc == 4)
m.motify(argv[3]);
else
m.motify();
return 0;
}