mirror of
https://github.com/apache/nuttx.git
synced 2026-09-08 18:06:33 +00:00
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 <lwazeh@gmail.com>
This commit is contained in:
parent
b2e43aca88
commit
e32faab34f
1 changed files with 9 additions and 0 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue