Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * (C) Copyright 2002 Linus Torvalds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Portions based on the vdso-randomization code from exec-shield:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * This file contains the needed initializations to support sysenter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/smp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/mm_types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/elf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <asm/processor.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm/vdso.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #ifdef CONFIG_COMPAT_VDSO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define VDSO_DEFAULT	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define VDSO_DEFAULT	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  * Should the kernel map a VDSO page into processes and pass its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)  * address down to glibc upon exec()?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) unsigned int __read_mostly vdso32_enabled = VDSO_DEFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) static int __init vdso32_setup(char *s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	vdso32_enabled = simple_strtoul(s, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	if (vdso32_enabled > 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 		pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 		vdso32_enabled = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)  * For consistency, the argument vdso32=[012] affects the 32-bit vDSO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)  * behavior on both 64-bit and 32-bit kernels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)  * On 32-bit kernels, vdso=[012] means the same thing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) __setup("vdso32=", vdso32_setup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #ifdef CONFIG_X86_32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) __setup_param("vdso=", vdso_setup, vdso32_setup, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) int __init sysenter_setup(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	init_vdso_image(&vdso_image_32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) subsys_initcall(sysenter_setup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #ifdef CONFIG_SYSCTL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) /* Register vsyscall32 into the ABI table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #include <linux/sysctl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) static struct ctl_table abi_table2[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 		.procname	= "vsyscall32",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 		.data		= &vdso32_enabled,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 		.maxlen		= sizeof(int),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 		.mode		= 0644,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 		.proc_handler	= proc_dointvec_minmax,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 		.extra1		= SYSCTL_ZERO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 		.extra2		= SYSCTL_ONE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) static struct ctl_table abi_root_table2[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) 		.procname = "abi",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 		.mode = 0555,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) 		.child = abi_table2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) static __init int ia32_binfmt_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) 	register_sysctl_table(abi_root_table2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) __initcall(ia32_binfmt_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #endif /* CONFIG_SYSCTL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #endif	/* CONFIG_X86_64 */