main.c (93fbff1197474d7b65e598c6f48fa82a5c334539) main.c (2e8cff0a0eee87b27f0cf87ad8310eb41b5886ab)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/init/main.c
4 *
5 * Copyright (C) 1991, 1992 Linus Torvalds
6 *
7 * GK 2/5/95 - Changed to support mounting root fs via NFS
8 * Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96

--- 1432 unchanged lines hidden (view full) ---

1441
1442 return ret;
1443}
1444
1445static noinline void __init kernel_init_freeable(void);
1446
1447#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
1448bool rodata_enabled __ro_after_init = true;
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/init/main.c
4 *
5 * Copyright (C) 1991, 1992 Linus Torvalds
6 *
7 * GK 2/5/95 - Changed to support mounting root fs via NFS
8 * Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96

--- 1432 unchanged lines hidden (view full) ---

1441
1442 return ret;
1443}
1444
1445static noinline void __init kernel_init_freeable(void);
1446
1447#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
1448bool rodata_enabled __ro_after_init = true;
1449
1450#ifndef arch_parse_debug_rodata
1451static inline bool arch_parse_debug_rodata(char *str) { return false; }
1452#endif
1453
1449static int __init set_debug_rodata(char *str)
1450{
1454static int __init set_debug_rodata(char *str)
1455{
1451 if (strtobool(str, &rodata_enabled))
1456 if (arch_parse_debug_rodata(str))
1457 return 0;
1458
1459 if (str && !strcmp(str, "on"))
1460 rodata_enabled = true;
1461 else if (str && !strcmp(str, "off"))
1462 rodata_enabled = false;
1463 else
1452 pr_warn("Invalid option string for rodata: '%s'\n", str);
1464 pr_warn("Invalid option string for rodata: '%s'\n", str);
1453 return 1;
1465 return 0;
1454}
1466}
1455__setup("rodata=", set_debug_rodata);
1467early_param("rodata", set_debug_rodata);
1456#endif
1457
1458#ifdef CONFIG_STRICT_KERNEL_RWX
1459static void mark_readonly(void)
1460{
1461 if (rodata_enabled) {
1462 /*
1463 * load_module() results in W+X mappings, which are cleaned

--- 174 unchanged lines hidden ---
1468#endif
1469
1470#ifdef CONFIG_STRICT_KERNEL_RWX
1471static void mark_readonly(void)
1472{
1473 if (rodata_enabled) {
1474 /*
1475 * load_module() results in W+X mappings, which are cleaned

--- 174 unchanged lines hidden ---