[libc-commits] [libc] [libc] Enable wide-read memory operations by default on Linux (PR #154602)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Aug 20 13:11:03 PDT 2025


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/154602

Summary:
This patch changes the linux build to use the wide reads on the memory
operations by default. These memory functions will now potentially read
outside of the bounds explicitly allowed by the current function. While
technically undefined behavior in the standard, plenty of C library
implementations do this. it will not cause a segmentation fault on linux
as long as you do not cross a page boundary, and because we are only
*reading* memory it should not have atomic effects.


>From e5591a2ba5450ec43bf92f1c487e8499126db753 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 20 Aug 2025 15:06:36 -0500
Subject: [PATCH] [libc] Enable wide-read memory operations by default on Linux

Summary:
This patch changes the linux build to use the wide reads on the memory
operations by default. These memory functions will now potentially read
outside of the bounds explicitly allowed by the current function. While
technically undefined behavior in the standard, plenty of C library
implementations do this. it will not cause a segmentation fault on linux
as long as you do not cross a page boundary, and because we are only
*reading* memory it should not have atomic effects.
---
 libc/config/linux/config.json | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 libc/config/linux/config.json

diff --git a/libc/config/linux/config.json b/libc/config/linux/config.json
new file mode 100644
index 0000000000000..30e8b2cdadabe
--- /dev/null
+++ b/libc/config/linux/config.json
@@ -0,0 +1,7 @@
+{
+  "string": {
+    "LIBC_CONF_STRING_UNSAFE_WIDE_READ": {
+      "value": true
+    }
+  }
+}



More information about the libc-commits mailing list