guomo233/LSM-based-RBAC

当我在虚拟机里编译内核的时候出现如下问题

Opened this issue · 2 comments

Lqs66 commented

security/GomoLSM/GomoLSM.c: In function ‘get_role’:
security/GomoLSM/GomoLSM.c:33:7: error: implicit declaration of function ‘get_fs’; did you mean ‘sget_fc’? [-Werror=implicit-function-declaration]
33 | fs = get_fs () ;
| ^~~~~~
| sget_fc
security/GomoLSM/GomoLSM.c:33:7: error: incompatible types when assigning to type ‘mm_segment_t’ {aka ‘struct ’} from type ‘int’
security/GomoLSM/GomoLSM.c:34:2: error: implicit declaration of function ‘set_fs’; did you mean ‘sget_fc’? [-Werror=implicit-function-declaration]
34 | set_fs (KERNEL_DS) ;
| ^~~~~~
| sget_fc
security/GomoLSM/GomoLSM.c:34:10: error: ‘KERNEL_DS’ undeclared (first use in this function)
34 | set_fs (KERNEL_DS) ;
| ^~~~~~~~~
security/GomoLSM/GomoLSM.c:34:10: note: each undeclared identifier is reported only once for each function it appears in
security/GomoLSM/GomoLSM.c: In function ‘role_permission’:
security/GomoLSM/GomoLSM.c:75:7: error: incompatible types when assigning to type ‘mm_segment_t’ {aka ‘struct ’} from type ‘int’
75 | fs = get_fs () ;
| ^~~~~~
security/GomoLSM/GomoLSM.c:76:10: error: ‘KERNEL_DS’ undeclared (first use in this function)
76 | set_fs (KERNEL_DS) ;
| ^~~~~~~~~
security/GomoLSM/GomoLSM.c: In function ‘is_enable’:
security/GomoLSM/GomoLSM.c:126:7: error: incompatible types when assigning to type ‘mm_segment_t’ {aka ‘struct ’} from type ‘int’
126 | fs = get_fs () ;
| ^~~~~~
security/GomoLSM/GomoLSM.c:127:10: error: ‘KERNEL_DS’ undeclared (first use in this function)
127 | set_fs (KERNEL_DS) ;
| ^~~~~~~~~
security/GomoLSM/GomoLSM.c: In function ‘gmlsm_add_hooks’:
security/GomoLSM/GomoLSM.c:182:5: error: too few arguments to function ‘security_add_hooks’
182 | security_add_hooks(gmlsm_hooks, ARRAY_SIZE(gmlsm_hooks));
| ^~~~~~~~~~~~~~~~~~

image
我该如何解决

从 Linux 内核 5.0 版本以后,内核地址空间相关的函数和宏定义,包括这里的 set_fs 、 get_fs 函数和 KERNEL_DS ,好像已经被移到了 linux/uaccess.h 中,不是原来的 asm/uaccess.h

xuzh0u commented

xs,强烈建议使用Ubuntu 16.04,规避99%的向后兼容问题