函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:init\main.c Create Date:2022-07-27 15:16:01
首页 Copyright©Brick

1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
bool rodata_enabled __ro_after_init = true;
static int __init set_debug_rodata(char *str)
{
    return strtobool(str, &rodata_enabled);
}
__setup("rodata=", set_debug_rodata);
#endif
 
#ifdef CONFIG_STRICT_KERNEL_RWX
static void mark_readonly(void)
{
    if (rodata_enabled) {
        /*
         * load_module() results in W+X mappings, which are cleaned
         * up with call_rcu().  Let's make sure that queued work is
         * flushed so that we don't hit false positives looking for
         * insecure pages which are W+X.
         */
        rcu_barrier();
        mark_rodata_ro();
        rodata_test();
    } else
        pr_info("Kernel memory protection disabled.\n");
}
#else
static inline void mark_readonly(void)
{
    pr_warn("This architecture does not have kernel memory protection.\n");
}