Linux kernel Hardware breakpoint registration failed with EACCES

247 Views Asked by At

I am using below code in my driver, but the register_wide_hw_breakpoint returns an EACESS error.

      hw_breakpoint_init(&attr);
        attr.bp_addr = kallsyms_lookup_name(ksym_name);
        attr.bp_len = HW_BREAKPOINT_LEN_4;
        attr.bp_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R;

        sample_hbp = register_wide_hw_breakpoint(&attr, sample_hbp_handler, NULL);
                if (IS_ERR((void __force *)sample_hbp)) {
                        ret = PTR_ERR((void __force *)sample_hbp);
                        printk(KERN_INFO "Breakpoint registration failed:%d\n",ret);
                }

What could be possible reasons for this? Am I missing a CONFIG option which will grant access to hardware registers?

Additional info: My platform is X86_64, Linux

Please help.

0

There are 0 best solutions below