mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "LeMay, Michael" <michael.lemay@intel.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: [RFC PATCH 2/7] avoid invoking the vDSO when SafeStack is enabled
Date: Tue, 27 Sep 2016 15:46:44 -0700	[thread overview]
Message-ID: <1b3f0226-a6f2-cd8f-85a5-2bded3b80d61@intel.com> (raw)

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



             reply	other threads:[~2016-09-27 22:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27 22:46 LeMay, Michael [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-09-27 22:35 LeMay, Michael

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b3f0226-a6f2-cd8f-85a5-2bded3b80d61@intel.com \
    --to=michael.lemay@intel.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).