[PATCH] yes: avoid failure on CHERI protected systems
From:
Pádraig Brady
Subject:
[PATCH] yes: avoid failure on CHERI protected systems
Date:
Wed, 15 Jan 2025 22:16:53 +0000
* src/yes.c (main): Don't reuse the argv array as CHERI's
capability bounds do not allow for that, failing like:
$ yes $(seq 156) | head -n1
In-address space security exception (core dumped)
---
src/yes.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/yes.c b/src/yes.c
index 396618cb5..ceb7ce447 100644
--- a/src/yes.c
+++ b/src/yes.c
@@ -96,6 +96,11 @@ main (int argc, char **argv)
reuse_operand_strings = false;
}
+#if defined __CHERI__
+ /* Cheri capability bounds do not allow for this. */
+ reuse_operand_strings = false;
+#endif
+
/* Fill the buffer with one copy of the output. If possible, reuse
the operands strings; this wins when the buffer would be large. */
char *buf = reuse_operand_strings ? *operands : xmalloc (bufalloc);
--
2.47.1
[Prev in Thread]
Current Thread
[Next in Thread]
[PATCH] yes: avoid failure on CHERI protected systems,
Pádraig Brady<=