mirror of
https://github.com/apache/nuttx.git
synced 2026-05-07 21:14:36 +08:00
fs/vfs: allow NULL iov_base in KERNEL build with zero-based text
Build Documentation / build-html (push) Has been cancelled
Build Documentation / build-html (push) Has been cancelled
This commit fixes a regression introduced by
89df084b0e. That commit
added a check to ensure iov_base is not NULL, assuming NULL
always represents an inaccessible address.
However, in CONFIG_BUILD_KERNEL mode where CONFIG_ARCH_TEXT_VBASE
is set to 0, address zero is a valid virtual address for the
user-space text segment. The previous check caused libelf to
fail with -EFAULT when attempting to load ELF program headers
into the base of the user address space.
This patch wraps the safety check in a conditional to ensure it is
only executed when address zero is not considered a valid
executable base.
Signed-off-by: Lwazi Dube <lwazeh@gmail.com>
This commit is contained in:
@@ -178,6 +178,7 @@ ssize_t file_readv(FAR struct file *filep,
|
||||
|
||||
/* Are all iov_base accessible? */
|
||||
|
||||
#if !defined(CONFIG_BUILD_KERNEL) || CONFIG_ARCH_TEXT_VBASE != 0
|
||||
for (ret = 0; ret < iovcnt; ret++)
|
||||
{
|
||||
if (iov[ret].iov_base == NULL && iov[ret].iov_len != 0)
|
||||
@@ -185,6 +186,7 @@ ssize_t file_readv(FAR struct file *filep,
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = -EBADF;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user