mailing list of musl libc
 help / color / mirror / code / Atom feed
* [RFC PATCH 2/7] avoid invoking the vDSO when SafeStack is enabled
@ 2016-09-27 22:46 LeMay, Michael
  0 siblings, 0 replies; 2+ messages in thread
From: LeMay, Michael @ 2016-09-27 22:46 UTC (permalink / raw)
  To: musl

The Linux vDSO code may be incompatible with programs that enable
segmentation-hardened SafeStack.  This patch prevents the vDSO from
being invoked when segmentation-hardened SafeStack is enabled.

Signed-off-by: Michael LeMay <michael.lemay@intel.com>
---
  arch/i386/syscall_arch.h | 13 +++++++++++++
  1 file changed, 13 insertions(+)

diff --git a/arch/i386/syscall_arch.h b/arch/i386/syscall_arch.h
index 4c9d874..08e0910 100644
--- a/arch/i386/syscall_arch.h
+++ b/arch/i386/syscall_arch.h
@@ -52,8 +52,21 @@ static inline long __syscall6(long n, long a1, long 
a2, long a3, long a4, long a
      return __ret;
  }

+#if !SAFE_STACK
+/* The vDSO is not compiled with segmentation-hardened SafeStack.  Avoid
+ * invoking the vDSO when hardened SafeStack is enabled, since it may 
try to
+ * access the stack using memory operands with base registers other 
than EBP or
+ * ESP without also using a stack segment override prefix.  A special 
compiler
+ * pass needs to be used to add such prefixes, and it is unlikely that 
a pass
+ * of that sort was applied when the vDSO was compiled.
+ *
+ * A possible alternative to disabling the use of the vDSO may be to 
load the
+ * default flat data segment into DS prior to invoking the vDSO and 
reloading
+ * the restricted data segment into DS after the vDSO routine returns.
+ */
  #define VDSO_USEFUL
  #define VDSO_CGT_SYM "__vdso_clock_gettime"
  #define VDSO_CGT_VER "LINUX_2.6"
+#endif

  #define SYSCALL_USE_SOCKETCALL
-- 
2.7.4



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [RFC PATCH 2/7] avoid invoking the vDSO when SafeStack is enabled
@ 2016-09-27 22:35 LeMay, Michael
  0 siblings, 0 replies; 2+ messages in thread
From: LeMay, Michael @ 2016-09-27 22:35 UTC (permalink / raw)
  To: musl

The Linux vDSO code may be incompatible with programs that enable
segmentation-hardened SafeStack.  This patch prevents the vDSO from
being invoked when segmentation-hardened SafeStack is enabled.

Signed-off-by: Michael LeMay <michael.lemay@intel.com>
---
  arch/i386/syscall_arch.h | 13 +++++++++++++
  1 file changed, 13 insertions(+)

diff --git a/arch/i386/syscall_arch.h b/arch/i386/syscall_arch.h
index 4c9d874..08e0910 100644
--- a/arch/i386/syscall_arch.h
+++ b/arch/i386/syscall_arch.h
@@ -52,8 +52,21 @@ static inline long __syscall6(long n, long a1, long 
a2, long a3, long a4, long a
      return __ret;
  }

+#if !SAFE_STACK
+/* The vDSO is not compiled with segmentation-hardened SafeStack.  Avoid
+ * invoking the vDSO when hardened SafeStack is enabled, since it may 
try to
+ * access the stack using memory operands with base registers other 
than EBP or
+ * ESP without also using a stack segment override prefix.  A special 
compiler
+ * pass needs to be used to add such prefixes, and it is unlikely that 
a pass
+ * of that sort was applied when the vDSO was compiled.
+ *
+ * A possible alternative to disabling the use of the vDSO may be to 
load the
+ * default flat data segment into DS prior to invoking the vDSO and 
reloading
+ * the restricted data segment into DS after the vDSO routine returns.
+ */
  #define VDSO_USEFUL
  #define VDSO_CGT_SYM "__vdso_clock_gettime"
  #define VDSO_CGT_VER "LINUX_2.6"
+#endif

  #define SYSCALL_USE_SOCKETCALL
-- 
2.7.4




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-27 22:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-27 22:46 [RFC PATCH 2/7] avoid invoking the vDSO when SafeStack is enabled LeMay, Michael
  -- strict thread matches above, loose matches on Subject: below --
2016-09-27 22:35 LeMay, Michael

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).