From 285d81be9725acc36dc8eca48d4df506cd5e6f6f Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Mon, 7 Sep 2020 15:43:04 +0200 Subject: libphobos: libdruntime doesn't support shadow stack (PR95680) Rather than implementing support within D runtime itself, use libc getcontext/swapcontext functions if CET is enabled. Removes whatever CET support was in the switchContext routine for x86 D runtime, along with setting version AsmExternal, so that the fallback ucontext_t implementation is used, which is capable of doing shadow stack handling. libphobos/ChangeLog: PR d/95680 * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac (DCFG_ENABLE_CET): Substitute. * libdruntime/Makefile.in: Regenerate. * libdruntime/config/x86/switchcontext.S: Remove CET support code. * libdruntime/core/thread.d: Import gcc.config. Don't set version AsmExternal when GNU_Enable_CET is true. * libdruntime/gcc/config.d.in (GNU_Enable_CET): Define. * src/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. --- libphobos/testsuite/Makefile.in | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libphobos/testsuite') diff --git a/libphobos/testsuite/Makefile.in b/libphobos/testsuite/Makefile.in index 66077fc..5a4c031 100644 --- a/libphobos/testsuite/Makefile.in +++ b/libphobos/testsuite/Makefile.in @@ -93,6 +93,8 @@ target_triplet = @target@ subdir = testsuite ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ + $(top_srcdir)/../config/cet.m4 \ + $(top_srcdir)/../config/enable.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/override.m4 \ @@ -149,6 +151,7 @@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CC_FOR_BUILD = @CC_FOR_BUILD@ +CET_FLAGS = @CET_FLAGS@ CFLAGS = @CFLAGS@ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ CHECKING_DFLAGS = @CHECKING_DFLAGS@ @@ -157,6 +160,7 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DCFG_ARM_EABI_UNWINDER = @DCFG_ARM_EABI_UNWINDER@ DCFG_DLPI_TLS_MODID = @DCFG_DLPI_TLS_MODID@ +DCFG_ENABLE_CET = @DCFG_ENABLE_CET@ DCFG_HAVE_64BIT_ATOMICS = @DCFG_HAVE_64BIT_ATOMICS@ DCFG_HAVE_ATOMIC_BUILTINS = @DCFG_HAVE_ATOMIC_BUILTINS@ DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@ -- cgit v1.1 From 0ed757604f4e232324ca798e46f3d8bf7e35b009 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Thu, 10 Sep 2020 01:30:20 +0200 Subject: libphobos: libdruntime doesn't support shadow stack (PR95680) The first implementation hit a front-end implementation bug where version conditions are resolved ahead of static if confitions. The logic for whether to use asm implemented fiber_switchContext or libc's swapcontext has been moved from GNU_Enable_CET to version CET. libphobos/ChangeLog: PR d/95680 PR d/97007 * Makefile.am (AM_MAKEFLAGS): Remove $(CET_FLAGS). * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac (DCFG_ENABLE_CET): Remove substitution. (CET_DFLAGS): Substitute. * libdruntime/Makefile.am (AM_DFLAGS): Add $(CET_DFLAGS). (AM_CFLAGS): Add $(CET_FLAGS). (AM_CCASFLAGS): Likewise. * libdruntime/Makefile.in: Regenerate. * libdruntime/core/thread.d: Replace static if GNU_Enable_CET condition with `version (CET)'. * libdruntime/gcc/config.d.in (GNU_Enable_CET): Remove. * src/Makefile.am (AM_DFLAGS): Add $(CET_DFLAGS). (AM_CFLAGS): Add $(CET_FLAGS). * src/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * testsuite/testsuite_flags.in: Add $(CET_DFLAGS) to --gdcflags. --- libphobos/testsuite/Makefile.in | 2 +- libphobos/testsuite/testsuite_flags.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'libphobos/testsuite') diff --git a/libphobos/testsuite/Makefile.in b/libphobos/testsuite/Makefile.in index 5a4c031..2f6911d 100644 --- a/libphobos/testsuite/Makefile.in +++ b/libphobos/testsuite/Makefile.in @@ -151,6 +151,7 @@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CC_FOR_BUILD = @CC_FOR_BUILD@ +CET_DFLAGS = @CET_DFLAGS@ CET_FLAGS = @CET_FLAGS@ CFLAGS = @CFLAGS@ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ @@ -160,7 +161,6 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DCFG_ARM_EABI_UNWINDER = @DCFG_ARM_EABI_UNWINDER@ DCFG_DLPI_TLS_MODID = @DCFG_DLPI_TLS_MODID@ -DCFG_ENABLE_CET = @DCFG_ENABLE_CET@ DCFG_HAVE_64BIT_ATOMICS = @DCFG_HAVE_64BIT_ATOMICS@ DCFG_HAVE_ATOMIC_BUILTINS = @DCFG_HAVE_ATOMIC_BUILTINS@ DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@ diff --git a/libphobos/testsuite/testsuite_flags.in b/libphobos/testsuite/testsuite_flags.in index 14b6795..6a2d79f 100755 --- a/libphobos/testsuite/testsuite_flags.in +++ b/libphobos/testsuite/testsuite_flags.in @@ -28,7 +28,7 @@ case ${query} in ;; --gdcflags) GDCFLAGS_default="-fmessage-length=0 -fno-show-column" - GDCFLAGS_config="@WARN_DFLAGS@ @GDCFLAGS@ -fno-release -funittest" + GDCFLAGS_config="@WARN_DFLAGS@ @GDCFLAGS@ @CET_DFLAGS@ -fno-release -funittest" echo ${GDCFLAGS_default} ${GDCFLAGS_config} ;; --gdcpaths) -- cgit v1.1 From edafa96b8210227b0c6a2d539aa41ce529805441 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Mon, 12 Oct 2020 10:11:44 +0200 Subject: libphobos: Override tool_timeout value in testsuite Some of the larger tests in the phobos testsuite on occasion trigger the default timeout limit. Increasing the limit to 10 minutes should give compilation enough time to finish. libphobos/ChangeLog: * testsuite/lib/libphobos.exp: Define tool_timeout, set to 600. --- libphobos/testsuite/lib/libphobos.exp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libphobos/testsuite') diff --git a/libphobos/testsuite/lib/libphobos.exp b/libphobos/testsuite/lib/libphobos.exp index 2e9da95..790480b 100644 --- a/libphobos/testsuite/lib/libphobos.exp +++ b/libphobos/testsuite/lib/libphobos.exp @@ -105,6 +105,7 @@ proc libphobos_init { args } { global gdcpaths gdcldflags global gluefile wrap_flags global ld_library_path + global tool_timeout global DEFAULT_DFLAGS # If a testcase doesn't have special options, use these. @@ -185,6 +186,9 @@ proc libphobos_init { args } { } } + # Set the default timeout for phobos tests. + set tool_timeout 600 + set_ld_library_path_env_vars libphobos_maybe_build_wrapper "${objdir}/testglue.o" -- cgit v1.1