xref: /aosp_15_r20/development/gki/kmi_abi_chk/kmi_sym_main.c (revision 90c8c64db3049935a07c6143d7fd006e26f8ecca)
1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <linux/module.h>    // included for all kernel modules
18 #include <linux/kernel.h>    // included for KERN_INFO
19 #include <linux/init.h>      // included for __init and __exit macros
20 #include <linux/stringify.h>
21 
22 MODULE_LICENSE("GPL");
23 MODULE_DESCRIPTION("A kernel module using all GKI KMI symbols");
24 MODULE_IMPORT_NS(CRYPTO_INTERNAL);
25 
26 extern void *kmi_sym_arr[];
27 
kmi_sym_init(void)28 static int __init kmi_sym_init(void)
29 {
30 	int cnt;
31 
32 	for (cnt = 0; kmi_sym_arr[cnt] != 0; ++cnt)
33 		;
34 	printk(KERN_INFO "GKI build: %s\n", __stringify(GKI_BID));
35 	printk(KERN_INFO "%d GKI KMI symbols at %p\n", cnt, kmi_sym_arr);
36 
37 	return 0;
38 }
39 
kmi_sym_cleanup(void)40 static void __exit kmi_sym_cleanup(void)
41 {
42 	printk(KERN_INFO "Cleaning up GKI KMI test.\n");
43 }
44 
45 module_init(kmi_sym_init);
46 module_exit(kmi_sym_cleanup);
47