This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new ff6597806d5 fs/vfs/fs_read.c: Allow NULL iov_base when
CONFIG_ARCH_TEXT_VBASE == 0
ff6597806d5 is described below
commit ff6597806d59e326886a478a2411196ee90cc204
Author: Lwazi Dube <[email protected]>
AuthorDate: Fri Aug 14 22:19:15 2026 -0400
fs/vfs/fs_read.c: Allow NULL iov_base when CONFIG_ARCH_TEXT_VBASE == 0
For kernel builds where CONFIG_ARCH_TEXT_VBASE is set to 0, allow a NULL
buffer in file_readv() to prevent ELF binary loading failures for
binaries located at address 0.
This fix was originally introduced in #18830, but was inadvertently
reverted by someone unaware that platforms with CONFIG_ARCH_TEXT_VBASE
equal to 0 cannot function at all without it. This commit restores the
necessary check to prevent regressions in zero-based text kernel
configurations. Most platforms remain completely unaffected since only
about 5 boards utilize a text virtual base of zero.
Signed-off-by: Lwazi Dube <[email protected]>
---
fs/vfs/fs_read.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/vfs/fs_read.c b/fs/vfs/fs_read.c
index a8e50e0a546..0ffc1e9715e 100644
--- a/fs/vfs/fs_read.c
+++ b/fs/vfs/fs_read.c
@@ -176,6 +176,14 @@ ssize_t file_readv(FAR struct file *filep,
return -EFAULT;
}
+ /* -------------------- DO NOT REMOVE --------------------
+ * Only for kernel builds with CONFIG_ARCH_TEXT_VBASE == 0.
+ * In this case we have to allow the NULL buffer otherwise
+ * kernel builds will fail to load elf binaries found at 0.
+ */
+
+#if !defined(CONFIG_BUILD_KERNEL) || CONFIG_ARCH_TEXT_VBASE != 0
+
/* Are all iov_base accessible? */
for (ret = 0; ret < iovcnt; ret++)
@@ -185,6 +193,7 @@ ssize_t file_readv(FAR struct file *filep,
return -EFAULT;
}
}
+#endif
ret = -EBADF;