aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2024-07-13 05:16:09 +0000
committerKyle Evans <kevans@FreeBSD.org>2024-07-13 05:16:23 +0000
commit4719366192d306a76e8e86bf926387f1c4122fd3 (patch)
tree93a1791f3951e72f501aef4677fc9cf0ce3cd34a /include
parent41c233dec6c15c543d3042c06833c1623456743c (diff)
downloadsrc-4719366192d306a76e8e86bf926387f1c4122fd3.tar.gz
src-4719366192d306a76e8e86bf926387f1c4122fd3.zip
libc: move __ssp_overlap back out into <ssp/ssp.h>
We'll be using it in some upcoming definitions in headers, so move it back now but slap a warning on it. Our upcoming uses will all be inside of inline functions, so we're not overly concerned about double evaluation immediately. Reviewed by: markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45677
Diffstat (limited to 'include')
-rw-r--r--include/ssp/ssp.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/ssp/ssp.h b/include/ssp/ssp.h
index 35a9aeee02df..622e9e901ba6 100644
--- a/include/ssp/ssp.h
+++ b/include/ssp/ssp.h
@@ -83,6 +83,13 @@ __ssp_inline rtype fun args { \
#define __ssp_redirect0(rtype, fun, args, call) \
__ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos0)
+/*
+ * Take caution when using __ssp_overlap! Don't use it in contexts where we
+ * can end up with double-evaluation of a statement with some side-effects.
+ */
+#define __ssp_overlap(a, b, l) \
+ (((a) <= (b) && (b) < (a) + (l)) || ((b) <= (a) && (a) < (b) + (l)))
+
__BEGIN_DECLS
void __stack_chk_fail(void) __dead2;
void __chk_fail(void) __dead2;