vdso32-setup.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. return 1;
  30. }
  31. /*
  32. * For consistency, the argument vdso32=[012] affects the 32-bit vDSO
  33. * behavior on both 64-bit and 32-bit kernels.
  34. * On 32-bit kernels, vdso=[012] means the same thing.
  35. */
  36. __setup("vdso32=", vdso32_setup);
  37. #ifdef CONFIG_X86_32
  38. __setup_param("vdso=", vdso_setup, vdso32_setup, 0);
  39. #endif
  40. int __init sysenter_setup(void)
  41. {
  42. init_vdso_image(&vdso_image_32);
  43. return 0;
  44. }
  45. #ifdef CONFIG_X86_64
  46. subsys_initcall(sysenter_setup);
  47. #ifdef CONFIG_SYSCTL
  48. /* Register vsyscall32 into the ABI table */
  49. #include <linux/sysctl.h>
  50. static struct ctl_table abi_table2[] = {
  51. {
  52. .procname = "vsyscall32",
  53. .data = &vdso32_enabled,
  54. .maxlen = sizeof(int),
  55. .mode = 0644,
  56. .proc_handler = proc_dointvec
  57. },
  58. {}
  59. };
  60. static struct ctl_table abi_root_table2[] = {
  61. {
  62. .procname = "abi",
  63. .mode = 0555,
  64. .child = abi_table2
  65. },
  66. {}
  67. };
  68. static __init int ia32_binfmt_init(void)
  69. {
  70. register_sysctl_table(abi_root_table2);
  71. return 0;
  72. }
  73. __initcall(ia32_binfmt_init);
  74. #endif /* CONFIG_SYSCTL */
  75. #endif /* CONFIG_X86_64 */