xiaoxiang781216 commented on code in PR #20415:
URL: https://github.com/apache/nuttx/pull/20415#discussion_r4154236360
##########
include/nuttx/addrenv.h:
##########
@@ -530,6 +536,16 @@ int addrenv_give(FAR struct addrenv_s *addrenv);
void addrenv_drop(FAR struct addrenv_s *addrenv, bool deferred);
+#ifdef CONFIG_BUILD_KERNEL
+bool uaccess_ok(FAR const void *ptr, size_t len);
+bool uaccess_nested(FAR const void *parent, FAR const void *ptr);
+void uaccess_check(FAR const void *ptr, size_t len);
Review Comment:
please follow linux naming and prototype
##########
arch/arm64/src/common/arm64_mmu.c:
##########
@@ -475,6 +500,13 @@ static void init_xlat_tables(const struct arm_mmu_region
*region)
sinfo("mmap: virt %lux phys %lux size %lux\n", virt, phys, size);
#endif
+#ifdef CONFIG_BUILD_KERNEL
+ if (size > 0 && arm64_overlaps_user(virt, size))
+ {
+ PANIC();
Review Comment:
why panic kernel, not abort the current process
##########
drivers/misc/addrenv.c:
##########
@@ -89,6 +89,7 @@ FAR void *up_addrenv_pa_to_va(uintptr_t pa)
return (FAR void *)pa;
}
+#ifndef CONFIG_BUILD_KERNEL
Review Comment:
should skip build this file in kernel mode
##########
libs/libc/syslog/lib_syslog.c:
##########
@@ -63,7 +65,15 @@ void vsyslog(int priority, FAR const IPTR char *fmt, va_list
ap)
* of structures in the NuttX syscalls does not work.
*/
-#ifdef va_copy
+#if defined(CONFIG_BUILD_KERNEL) && !defined(__KERNEL__)
+ FAR char *msg;
+
+ if (vasprintf(&msg, fmt, ap) >= 0)
Review Comment:
why format in the userspace
##########
syscall/syscall_uaccess.c:
##########
@@ -274,6 +279,20 @@ int uaccess_ioctl(int fd, int req, ...)
arg = va_arg(ap, unsigned long);
va_end(ap);
+ switch (req)
+ {
+ case BIOC_XIPBASE:
Review Comment:
but xip memory is read only
##########
include/nuttx/addrenv.h:
##########
@@ -530,6 +536,16 @@ int addrenv_give(FAR struct addrenv_s *addrenv);
void addrenv_drop(FAR struct addrenv_s *addrenv, bool deferred);
+#ifdef CONFIG_BUILD_KERNEL
Review Comment:
why not check for protected build
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]