Ladies and gentlemen, I haven't solved a problem when compiling the kernel module for a long time. Please help me to see it,
666 static _ init int cbac_init (void)
667 {
668 struct cred * cred;
669
670 if (! Security_module_enable (& cbac_ops ))
671 return 0;
672
673 printk (KERN_INFO "cbac: InitializE ");
674 /*
675 * Set the security state for the initial task.
676 */
677 cred = (struct cred *) current-> cred;
678 cred-> security = & c_f_key.cbackey;
679
680/* register new key */
681 // if (register_key_type (struct key_type * ckey ))
682 // printk (KERN_INFO "cbackey initialized ");
683/* Register with LSM */
684 if (register_security (& cbac_ops ))
685 panic ("cbac: Unable to register with kernel. \ n ");
686
687 return 0;
688}
689
690/* cbac requires early initialization in order to label
691 * all processes and objects when they are created.
692 */
693 security_initcall (cbac_init );
Debugging result:
Security/CBAC/cbac_lsm.c: 665: 20: Error: The function 'cbac _ init 'storage class is invalid.
Security/CBAC/cbac_lsm.c: 693: 1: error: the initial value setting element is not a constant.
Security/CBAC/cbac_lsm.c: 693: 1: Error: expected declaration or statement at end of input
It is a kernel module that registers and initializes functions. It is written in the same way as the existing functions in the source code.
The function body can be ignored, mainly because 666 and 693 rows have errors.
The 'cbac _ init 'storage class of the function is invalid. Removing the static keyword will eliminate this error, but the problem still cannot be solved,
If the source code is added with the static keyword, it will be okay. I will report an error here. I don't know why.
The most hateful functions are the _ Init (macro) of the 666 rows and the security_initcall of the 693 rows.
You can query these two functions in the lxr. Linux. no/# Linux + v2.6.39/search box.
Ask a friend to help eliminate the second line of error. Thank you!