[libc-commits] [libc] [libc] fix sysconf test for rv32 (PR #162685)
via libc-commits
libc-commits at lists.llvm.org
Thu Oct 9 08:52:12 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Schrodinger ZHU Yifan (SchrodingerZhu)
<details>
<summary>Changes</summary>
On 32-bit architectures, MMAP may return userspace virtual address with high bit set. This patch copy the err detection logic from existing mmap function implementation.
---
Full diff: https://github.com/llvm/llvm-project/pull/162685.diff
1 Files Affected:
- (modified) libc/src/__support/OSUtil/linux/auxv.h (+2-1)
``````````diff
diff --git a/libc/src/__support/OSUtil/linux/auxv.h b/libc/src/__support/OSUtil/linux/auxv.h
index 894868ae5824d..cca0f358e2366 100644
--- a/libc/src/__support/OSUtil/linux/auxv.h
+++ b/libc/src/__support/OSUtil/linux/auxv.h
@@ -16,6 +16,7 @@
#include <linux/auxvec.h> // For AT_ macros
#include <linux/mman.h> // For mmap flags
+#include <linux/param.h> // For EXEC_PAGESIZE
#include <linux/prctl.h> // For prctl
#include <sys/syscall.h> // For syscall numbers
@@ -90,7 +91,7 @@ LIBC_INLINE void Vector::fallback_initialize_unsync() {
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
// We do not proceed if mmap fails.
- if (mmap_ret <= 0)
+ if (mmap_ret <= 0 && mmap_ret > -EXEC_PAGESIZE)
return;
// Initialize the auxv array with AT_NULL entries.
``````````
</details>
https://github.com/llvm/llvm-project/pull/162685
More information about the libc-commits
mailing list