aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2024-04-30 10:42:22 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2024-04-30 10:58:15 +0300
commit76e0ed0a5abcd6ba913ce8af2eb5aacbff41ae3b (patch)
tree93d91321541c3ea5b1974a36da76736a371890b0 /contrib/restricted
parente8eb833d0f435024959684eaabe6d40df18c7359 (diff)
downloadydb-76e0ed0a5abcd6ba913ce8af2eb5aacbff41ae3b.tar.gz
Update contrib/restricted/boost/context to 1.85.0
632d17c9f4e16a5595cd4066996ca228e9ed469f
Diffstat (limited to 'contrib/restricted')
-rw-r--r--contrib/restricted/boost/context/fcontext_impl/ya.make4
-rw-r--r--contrib/restricted/boost/context/impl_common/ya.make4
-rw-r--r--contrib/restricted/boost/context/src/asm/jump_i386_sysv_elf_gas.S99
-rw-r--r--contrib/restricted/boost/context/src/asm/jump_x86_64_sysv_elf_gas.S24
-rw-r--r--contrib/restricted/boost/context/src/asm/make_i386_sysv_elf_gas.S119
-rw-r--r--contrib/restricted/boost/context/src/asm/make_x86_64_sysv_elf_gas.S57
6 files changed, 290 insertions, 17 deletions
diff --git a/contrib/restricted/boost/context/fcontext_impl/ya.make b/contrib/restricted/boost/context/fcontext_impl/ya.make
index 07d98b1b86..48eed3e403 100644
--- a/contrib/restricted/boost/context/fcontext_impl/ya.make
+++ b/contrib/restricted/boost/context/fcontext_impl/ya.make
@@ -4,9 +4,9 @@ LIBRARY()
WITHOUT_LICENSE_TEXTS()
-VERSION(1.84.0)
+VERSION(1.85.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/context/archive/boost-1.84.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/context/archive/boost-1.85.0.tar.gz)
LICENSE(BSL-1.0)
diff --git a/contrib/restricted/boost/context/impl_common/ya.make b/contrib/restricted/boost/context/impl_common/ya.make
index 462fd5312a..4724feba1c 100644
--- a/contrib/restricted/boost/context/impl_common/ya.make
+++ b/contrib/restricted/boost/context/impl_common/ya.make
@@ -4,9 +4,9 @@ LIBRARY()
WITHOUT_LICENSE_TEXTS()
-VERSION(1.84.0)
+VERSION(1.85.0)
-ORIGINAL_SOURCE(https://github.com/boostorg/context/archive/boost-1.84.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/boostorg/context/archive/boost-1.85.0.tar.gz)
LICENSE(BSL-1.0)
diff --git a/contrib/restricted/boost/context/src/asm/jump_i386_sysv_elf_gas.S b/contrib/restricted/boost/context/src/asm/jump_i386_sysv_elf_gas.S
new file mode 100644
index 0000000000..ed83717ce2
--- /dev/null
+++ b/contrib/restricted/boost/context/src/asm/jump_i386_sysv_elf_gas.S
@@ -0,0 +1,99 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/****************************************************************************************
+ * *
+ * ---------------------------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
+ * ---------------------------------------------------------------------------------- *
+ * | fc_mxcsr|fc_x87_cw| guard | EDI | ESI | EBX | EBP | EIP | *
+ * ---------------------------------------------------------------------------------- *
+ * ---------------------------------------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x20 | 0x24 | 0x28 | | *
+ * ---------------------------------------------------------------------------------- *
+ * | hidden | to | data | | *
+ * ---------------------------------------------------------------------------------- *
+ * *
+ ****************************************************************************************/
+
+#ifdef __x86_64__
+#include "jump_x86_64_sysv_elf_gas.S"
+#else
+
+.file "jump_i386_sysv_elf_gas.S"
+.text
+.globl jump_fcontext
+.align 2
+.type jump_fcontext,@function
+jump_fcontext:
+ leal -0x1c(%esp), %esp /* prepare stack */
+
+#if !defined(BOOST_USE_TSX)
+ stmxcsr (%esp) /* save MMX control- and status-word */
+ fnstcw 0x4(%esp) /* save x87 control-word */
+#endif
+
+#if defined(BOOST_CONTEXT_TLS_STACK_PROTECTOR)
+ movl %gs:0x14, %ecx /* read stack guard from TLS record */
+ movl %ecx, 0x8(%esp) /* save stack guard */
+#endif
+
+ movl %edi, 0xc(%esp) /* save EDI */
+ movl %esi, 0x10(%esp) /* save ESI */
+ movl %ebx, 0x14(%esp) /* save EBX */
+ movl %ebp, 0x18(%esp) /* save EBP */
+
+ /* store ESP (pointing to context-data) in ECX */
+ movl %esp, %ecx
+
+ /* first arg of jump_fcontext() == fcontext to jump to */
+ movl 0x24(%esp), %eax
+
+ /* second arg of jump_fcontext() == data to be transferred */
+ movl 0x28(%esp), %edx
+
+ /* restore ESP (pointing to context-data) from EAX */
+ movl %eax, %esp
+
+ /* address of returned transport_t */
+ movl 0x20(%esp), %eax
+ /* return parent fcontext_t */
+ movl %ecx, (%eax)
+ /* return data */
+ movl %edx, 0x4(%eax)
+
+ movl 0x1c(%esp), %ecx /* restore EIP */
+
+#if !defined(BOOST_USE_TSX)
+ ldmxcsr (%esp) /* restore MMX control- and status-word */
+ fldcw 0x4(%esp) /* restore x87 control-word */
+#endif
+
+#if defined(BOOST_CONTEXT_TLS_STACK_PROTECTOR)
+ movl 0x8(%esp), %edx /* load stack guard */
+ movl %edx, %gs:0x14 /* restore stack guard to TLS record */
+#endif
+
+ movl 0xc(%esp), %edi /* restore EDI */
+ movl 0x10(%esp), %esi /* restore ESI */
+ movl 0x14(%esp), %ebx /* restore EBX */
+ movl 0x18(%esp), %ebp /* restore EBP */
+
+ leal 0x24(%esp), %esp /* prepare stack */
+
+ /* jump to context */
+ jmp *%ecx
+.size jump_fcontext,.-jump_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
+
+#endif
diff --git a/contrib/restricted/boost/context/src/asm/jump_x86_64_sysv_elf_gas.S b/contrib/restricted/boost/context/src/asm/jump_x86_64_sysv_elf_gas.S
index 58f0e241d7..be264bdc2e 100644
--- a/contrib/restricted/boost/context/src/asm/jump_x86_64_sysv_elf_gas.S
+++ b/contrib/restricted/boost/context/src/asm/jump_x86_64_sysv_elf_gas.S
@@ -31,13 +31,16 @@
* *
****************************************************************************************/
-# if defined __CET__
-# include <cet.h>
-# define SHSTK_ENABLED (__CET__ & 0x2)
-# define BOOST_CONTEXT_SHADOW_STACK (SHSTK_ENABLED && SHADOW_STACK_SYSCALL)
+# ifdef __i386__
+# include "jump_i386_sysv_elf_gas.S"
# else
-# define _CET_ENDBR
-# endif
+# if defined __CET__
+# include <cet.h>
+# define SHSTK_ENABLED (__CET__ & 0x2)
+# define BOOST_CONTEXT_SHADOW_STACK (SHSTK_ENABLED && SHADOW_STACK_SYSCALL)
+# else
+# define _CET_ENDBR
+# endif
.file "jump_x86_64_sysv_elf_gas.S"
.text
.globl jump_fcontext
@@ -72,6 +75,14 @@ jump_fcontext:
movq %rcx, (%rsp)
#endif
+#if BOOST_CONTEXT_SHADOW_STACK
+ /* grow the stack to reserve space for shadow stack pointer(SSP) */
+ leaq -0x8(%rsp), %rsp
+ /* read the current SSP and store it */
+ rdsspq %rcx
+ movq %rcx, (%rsp)
+# endif
+
/* store RSP (pointing to context-data) in RAX */
movq %rsp, %rax
@@ -140,3 +151,4 @@ jump_fcontext:
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
+# endif
diff --git a/contrib/restricted/boost/context/src/asm/make_i386_sysv_elf_gas.S b/contrib/restricted/boost/context/src/asm/make_i386_sysv_elf_gas.S
new file mode 100644
index 0000000000..c6e0b36558
--- /dev/null
+++ b/contrib/restricted/boost/context/src/asm/make_i386_sysv_elf_gas.S
@@ -0,0 +1,119 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/****************************************************************************************
+ * *
+ * ---------------------------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
+ * ---------------------------------------------------------------------------------- *
+ * | fc_mxcsr|fc_x87_cw| guard | EDI | ESI | EBX | EBP | EIP | *
+ * ---------------------------------------------------------------------------------- *
+ * ---------------------------------------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x20 | 0x24 | 0x28 | | *
+ * ---------------------------------------------------------------------------------- *
+ * | hidden | to | data | | *
+ * ---------------------------------------------------------------------------------- *
+ * *
+ ****************************************************************************************/
+
+#ifdef __x86_64__
+#include "make_x86_64_sysv_elf_gas.S"
+#else
+
+.file "make_i386_sysv_elf_gas.S"
+.text
+.globl make_fcontext
+.align 2
+.type make_fcontext,@function
+make_fcontext:
+ /* first arg of make_fcontext() == top of context-stack */
+ movl 0x4(%esp), %eax
+
+ /* reserve space for first argument of context-function
+ eax might already point to a 16byte border */
+ leal -0x8(%eax), %eax
+
+ /* shift address in EAX to lower 16 byte boundary */
+ andl $-16, %eax
+
+ /* reserve space for context-data on context-stack, and align the stack */
+ leal -0x34(%eax), %eax
+
+ /* third arg of make_fcontext() == address of context-function */
+ /* stored in EBX */
+ movl 0xc(%esp), %ecx
+ movl %ecx, 0x14(%eax)
+
+ /* save MMX control- and status-word */
+ stmxcsr (%eax)
+ /* save x87 control-word */
+ fnstcw 0x4(%eax)
+
+#if defined(BOOST_CONTEXT_TLS_STACK_PROTECTOR)
+ /* save stack guard */
+ movl %gs:0x14, %ecx /* read stack guard from TLS record */
+ movl %ecx, 0x8(%eax) /* save stack guard */
+#endif
+
+ /* return transport_t */
+ /* FCTX == EDI, DATA == ESI */
+ leal 0xc(%eax), %ecx
+ movl %ecx, 0x20(%eax)
+
+ /* compute abs address of label trampoline */
+ call 1f
+ /* address of trampoline 1 */
+1: popl %ecx
+ /* compute abs address of label trampoline */
+ addl $trampoline-1b, %ecx
+ /* save address of trampoline as return address */
+ /* will be entered after calling jump_fcontext() first time */
+ movl %ecx, 0x1c(%eax)
+
+ /* compute abs address of label finish */
+ call 2f
+ /* address of label 2 */
+2: popl %ecx
+ /* compute abs address of label finish */
+ addl $finish-2b, %ecx
+ /* save address of finish as return-address for context-function */
+ /* will be entered after context-function returns */
+ movl %ecx, 0x18(%eax)
+
+ ret /* return pointer to context-data */
+
+trampoline:
+ /* move transport_t for entering context-function */
+ movl %edi, (%esp)
+ movl %esi, 0x4(%esp)
+ pushl %ebp
+ /* jump to context-function */
+ jmp *%ebx
+
+finish:
+ call 3f
+ /* address of label 3 */
+3: popl %ebx
+ /* compute address of GOT and store it in EBX */
+ addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx
+
+ /* exit code is zero */
+ xorl %eax, %eax
+ movl %eax, (%esp)
+ /* exit application */
+ call _exit@PLT
+ hlt
+.size make_fcontext,.-make_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
+
+#endif
diff --git a/contrib/restricted/boost/context/src/asm/make_x86_64_sysv_elf_gas.S b/contrib/restricted/boost/context/src/asm/make_x86_64_sysv_elf_gas.S
index 4294398a2e..b0d0c0341e 100644
--- a/contrib/restricted/boost/context/src/asm/make_x86_64_sysv_elf_gas.S
+++ b/contrib/restricted/boost/context/src/asm/make_x86_64_sysv_elf_gas.S
@@ -31,13 +31,16 @@
* *
****************************************************************************************/
-# if defined __CET__
-# include <cet.h>
-# define SHSTK_ENABLED (__CET__ & 0x2)
-# define BOOST_CONTEXT_SHADOW_STACK (SHSTK_ENABLED && SHADOW_STACK_SYSCALL)
+# ifdef __i386__
+# include "make_i386_sysv_elf_gas.S"
# else
-# define _CET_ENDBR
-# endif
+# if defined __CET__
+# include <cet.h>
+# define SHSTK_ENABLED (__CET__ & 0x2)
+# define BOOST_CONTEXT_SHADOW_STACK (SHSTK_ENABLED && SHADOW_STACK_SYSCALL)
+# else
+# define _CET_ENDBR
+# endif
.file "make_x86_64_sysv_elf_gas.S"
.text
.globl make_fcontext
@@ -45,6 +48,7 @@
.align 16
make_fcontext:
_CET_ENDBR
+
#if BOOST_CONTEXT_SHADOW_STACK
/* the new shadow stack pointer (SSP) */
movq -0x8(%rdi), %r9
@@ -116,12 +120,50 @@ make_fcontext:
movq %r9, (%rax)
#endif
+#if BOOST_CONTEXT_SHADOW_STACK
+ /* Populate the shadow stack */
+
+ /* get original SSP */
+ rdsspq %r8
+ /* restore new shadow stack */
+ rstorssp -0x8(%r9)
+ /* save the restore token on the original shadow stack */
+ saveprevssp
+ /* push the address of "jmp trampoline" to the new shadow stack */
+ /* as well as the stack */
+ call 1f
+ jmp trampoline
+1:
+ /* save address of "jmp trampoline" as return-address */
+ /* for context-function */
+ pop 0x38(%rax)
+ /* Get the new SSP. */
+ rdsspq %r9
+ /* restore original shadow stack */
+ rstorssp -0x8(%r8)
+ /* save the restore token on the new shadow stack. */
+ saveprevssp
+
+ /* now the new shadow stack looks like:
+ base-> +------------------------------+
+ | address of "jmp trampoline" |
+ SSP-> +------------------------------+
+ | restore token |
+ +------------------------------+
+ */
+
+ /* reserve space for the new SSP */
+ leaq -0x8(%rax), %rax
+ /* save the new SSP to this fcontext */
+ movq %r9, (%rax)
+#endif
+
ret /* return pointer to context-data */
trampoline:
- _CET_ENDBR
/* store return address on stack */
/* fix stack alignment */
+ _CET_ENDBR
#if BOOST_CONTEXT_SHADOW_STACK
/* save address of "jmp *%rbp" as return-address */
/* on stack and shadow stack */
@@ -145,3 +187,4 @@ finish:
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
+# endif