royzah commented on code in PR #20412:
URL: https://github.com/apache/nuttx/pull/20412#discussion_r4162958511
##########
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:
not in this one, protected build got no MMU split, so access_ok would need
to look at the MPU regions. can do it as follow-up if u want
##########
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 access_ok(FAR const void *ptr, size_t len);
+bool uaccess_nested(FAR const void *parent, FAR const void *ptr);
Review Comment:
for user pointers inside user structs, like iov_base or msghdr buffers. its
callers moved to the split-out part, so if u prefer I drop it from here and add
it there
##########
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 access_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:
access_ok is the linux name, rest just followed uaccess. happy to rename all
to one prefix, which one u like?
##########
arch/arm64/src/common/arm64_mmu.c:
##########
@@ -458,6 +462,27 @@ static void split_pte_block_desc(uint64_t *pte, int level)
set_pte_table_desc(pte, new_table, level);
}
+#ifdef CONFIG_BUILD_KERNEL
+static bool arm64_overlaps_user(uintptr_t virt, size_t size)
Review Comment:
done, is_user_overlap now
##########
arch/risc-v/src/common/riscv_mmu.c:
##########
@@ -41,6 +45,27 @@
* Private Functions
****************************************************************************/
+#ifdef CONFIG_BUILD_KERNEL
+static bool riscv_overlaps_user(uintptr_t vaddr, size_t size)
Review Comment:
done
##########
arch/x86_64/src/common/x86_64_addrenv.c:
##########
@@ -994,3 +994,16 @@ int up_addrenv_detach(struct tcb_s *tcb)
return OK;
}
+
+/****************************************************************************
+ * Name: up_addrenv_user_vaddr
+ *
+ * Description:
+ * Check if a virtual address is in user virtual address space.
+ *
+ ****************************************************************************/
+
+bool up_addrenv_user_vaddr(uintptr_t vaddr)
+{
+ return x86_64_uservaddr(vaddr);
Review Comment:
done, merged it in and x86_64_uservaddr is gone, pgalloc uses
up_addrenv_user_vaddr now
##########
tools/mksyscall.c:
##########
@@ -35,9 +35,29 @@
* Private Data
****************************************************************************/
+struct uvalue_s
+{
+ const char *name;
+ int parm;
+};
+
static bool g_inline;
static FILE *g_stubstream;
+static const char * const g_uwrapped[] =
Review Comment:
fair. took the mksyscall part out of this PR
--
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]