This repository was archived by the owner on Mar 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +21
-9
lines changed Expand file tree Collapse file tree 6 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const INCLUDED_FUNCTIONS: &[&str] = &[
13
13
"kfree" ,
14
14
"mount_nodev" ,
15
15
"kill_litter_super" ,
16
+ "BINDINGS_BUG" ,
16
17
] ;
17
18
const INCLUDED_VARS : & [ & str ] = & [
18
19
"EINVAL" ,
Original file line number Diff line number Diff line change 1
1
obj-m := helloworld.o
2
- helloworld-objs := target/x86_64-linux-kernel-module/debug/libhello_world.a ../src/printk_helper .o
2
+ helloworld-objs := target/x86_64-linux-kernel-module/debug/libhello_world.a ../src/helpers .o
3
3
EXTRA_LDFLAGS += --gc-sections --entry=init_module --undefined=cleanup_module
4
4
5
5
all :
Original file line number Diff line number Diff line change
1
+ #include <linux/printk.h>
2
+
3
+ int printk_helper (const unsigned char * s , int len )
4
+ {
5
+ return printk (KERN_INFO "%.*s" , len , (const char * )s );
6
+ }
7
+
8
+ void bug_helper ()
9
+ {
10
+ BUG ();
11
+ }
Original file line number Diff line number Diff line change @@ -64,12 +64,18 @@ pub trait KernelModule: Sized {
64
64
fn init ( ) -> KernelResult < Self > ;
65
65
}
66
66
67
+ extern "C" {
68
+ fn bug_helper ( ) -> !;
69
+ }
70
+
67
71
#[ lang = "eh_personality" ]
68
72
extern "C" fn eh_personality ( ) { }
69
73
70
74
#[ lang = "panic_fmt" ]
71
75
extern "C" fn panic_fmt ( ) -> ! {
72
- loop { }
76
+ unsafe {
77
+ bug_helper ( ) ;
78
+ }
73
79
}
74
80
75
81
#[ global_allocator]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
obj-m := staticfilesystem.o
2
- staticfilesystem-objs := target/x86_64-linux-kernel-module/debug/libstatic_filesystem.a ../src/printk_helper .o
2
+ staticfilesystem-objs := target/x86_64-linux-kernel-module/debug/libstatic_filesystem.a ../src/helpers .o
3
3
EXTRA_LDFLAGS += --gc-sections --entry=init_module --undefined=cleanup_module
4
4
5
5
all :
You can’t perform that action at this time.
0 commit comments