vdso32-setup.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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/processor.h>
  13. #include <asm/vdso.h>
  14. #ifdef CONFIG_COMPAT_VDSO
  15. #define VDSO_DEFAULT 0
  16. #else
  17. #define VDSO_DEFAULT 1
  18. #endif
  19. /*
  20. * Should the kernel map a VDSO page into processes and pass its
  21. * address down to glibc upon exec()?
  22. */
  23. unsigned int __read_mostly vdso32_enabled = VDSO_DEFAULT;
  24. static int __init vdso32_setup(char *s)
  25. {
  26. vdso32_enabled = simple_strtoul(s, NULL, 0);
  27. if (vdso32_enabled > 1) {
  28. pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");
  29. vdso32_enabled = 0;
  30. }
  31. return 1;
  32. }
  33. /*
  34. * For consistency, the argument vdso32=[012] affects the 32-bit vDSO
  35. * behavior on both 64-bit and 32-bit kernels.
  36. * On 32-bit kernels, vdso=[012] means the same thing.
  37. */
  38. __setup("vdso32=", vdso32_setup);
  39. #ifdef CONFIG_X86_32
  40. __setup_param("vdso=", vdso_setup, vdso32_setup, 0);
  41. #endif
  42. int __init sysenter_setup(void)
  43. {
  44. init_vdso_image(&vdso_image_32);
  45. return 0;
  46. }
  47. #ifdef CONFIG_X86_64
  48. subsys_initcall(sysenter_setup);
  49. #ifdef CONFIG_SYSCTL
  50. /* Register vsyscall32 into the ABI table */
  51. #include <linux/sysctl.h>
  52. static const int zero;
  53. static const int one = 1;
  54. static struct ctl_table abi_table2[] = {
  55. {
  56. .procname = "vsyscall32",
  57. .data = &vdso32_enabled,
  58. .maxlen = sizeof(int),
  59. .mode = 0644,
  60. .proc_handler = proc_dointvec_minmax,
  61. .extra1 = (int *)&zero,
  62. .extra2 = (int *)&one,
  63. },
  64. {}
  65. };
  66. static struct ctl_table abi_root_table2[] = {
  67. {
  68. .procname = "abi",
  69. .mode = 0555,
  70. .child = abi_table2
  71. },
  72. {}
  73. };
  74. static __init int ia32_binfmt_init(void)
  75. {
  76. register_sysctl_table(abi_root_table2);
  77. return 0;
  78. }
  79. __initcall(ia32_binfmt_init);
  80. #endif /* CONFIG_SYSCTL */
  81. #endif /* CONFIG_X86_64 */