From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10531 Path: news.gmane.org!.POSTED!not-for-mail From: "LeMay, Michael" Newsgroups: gmane.linux.lib.musl.general Subject: [RFC PATCH 2/7] avoid invoking the vDSO when SafeStack is enabled Date: Tue, 27 Sep 2016 15:46:44 -0700 Message-ID: <1b3f0226-a6f2-cd8f-85a5-2bded3b80d61@intel.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1475016439 30848 195.159.176.226 (27 Sep 2016 22:47:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Sep 2016 22:47:19 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 To: "musl@lists.openwall.com" Original-X-From: musl-return-10544-gllmg-musl=m.gmane.org@lists.openwall.com Wed Sep 28 00:47:15 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1bp19N-0005Qs-UB for gllmg-musl@m.gmane.org; Wed, 28 Sep 2016 00:46:58 +0200 Original-Received: (qmail 11309 invoked by uid 550); 27 Sep 2016 22:46:58 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 11283 invoked from network); 27 Sep 2016 22:46:56 -0000 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,407,1470726000"; d="scan'208";a="14392434" Xref: news.gmane.org gmane.linux.lib.musl.general:10531 Archived-At: 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 --- 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