Linux Kernel module debugging Error

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.