vdso32-setup.c 1.9 KB

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