[libc-commits] [libc] [libc] fortify jmp buffer for x86-64 (PR #112769)
Simon Tatham via libc-commits
libc-commits at lists.llvm.org
Fri Oct 18 08:52:33 PDT 2024
================
@@ -11,35 +11,97 @@
#include "src/__support/macros/config.h"
#include "src/setjmp/setjmp_impl.h"
+#if LIBC_COPT_SETJMP_ENABLE_FORTIFICATION
+#include "src/setjmp/checksum.h"
+#endif
+
#if !defined(LIBC_TARGET_ARCH_IS_X86_64)
#error "Invalid file include"
#endif
-namespace LIBC_NAMESPACE_DECL {
+#if LIBC_COPT_SETJMP_ENABLE_FORTIFICATION
+#define ACCUMULATE_CHECKSUM() \
----------------
statham-arm wrote:
There are still two copies of this, one here and the other in `longjmp.cpp`. They have to match, or the checksum computed by `setjmp` won't agree with the one `longjmp` expects. So surely there should be one copy of the implementation, and it should live in a header file that both source files include.
That's also a good place to put the comment explaining the choice of algorithm.
https://github.com/llvm/llvm-project/pull/112769
More information about the libc-commits
mailing list