]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
compiler: -fexceptions hardening 2901/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 11 Mar 2019 22:36:02 +0000 (23:36 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 11 Mar 2019 22:36:02 +0000 (23:36 +0100)
This hardens multi-threaded C. Without it, the implementation of thread
cancellation handlers (introduced by pthread_cleanup_push) uses a completely
unprotected function pointer on the stack. This function pointer can simplify
the exploitation of stack-based buffer overflows even if the thread in question
is never canceled.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
configure.ac

index 28efe43e179280840ed50b8191f2c6ba70f0dd4e..3abee054f754c5342ef2dcd9299e1bdaefa82e35 100644 (file)
@@ -721,6 +721,7 @@ AX_CHECK_COMPILE_FLAG([-Wdate-time], [CFLAGS="$CFLAGS -Wdate-time"],,[-Werror])
 AX_CHECK_COMPILE_FLAG([-Wnested-externs], [CFLAGS="$CFLAGS -Wnested-externs"],,[-Werror])
 AX_CHECK_COMPILE_FLAG([-fasynchronous-unwind-tables], [CFLAGS="$CFLAGS -fasynchronous-unwind-tables"],,[-Werror])
 AX_CHECK_COMPILE_FLAG([-pipe], [CFLAGS="$CFLAGS -pipe"],,[-Werror])
+AX_CHECK_COMPILE_FLAG([-fexceptions], [CFLAGS="$CFLAGS -fexceptions"],,[-Werror])
 
 AX_CHECK_LINK_FLAG([-z relro], [LDLAGS="$LDLAGS -z relro"],,[])
 AX_CHECK_LINK_FLAG([-z now], [LDLAGS="$LDLAGS -z now"],,[])