Skip to contentSkip to conversation

linux-user: Add move_mount() syscall

PATCH Applied Thomas Weißschuh 2 participants 6 messages Apr 24, 2023 – May 1, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 linux-user: Add move_mount() syscall

---
 linux-user/syscall.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
linux-user/syscall.c +27 -0
index 69f740ff98c8..95e370130cee 100644
@@ -9139,6 +9139,33 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
         unlock_user(p, arg1, 0);
         return ret;
 #endif
+#ifdef TARGET_NR_move_mount
+    case TARGET_NR_move_mount:
+        {
+            void *p2, *p4;
+
+            if (!arg2 || !arg4) {
+                return -TARGET_EFAULT;
+            }
+
+            p2 = lock_user_string(arg2);
+            if (!p2) {
+                return -TARGET_EFAULT;
+            }
+
+            p4 = lock_user_string(arg4);
+            if (!p4) {
+                unlock_user(p2, arg2, 0);
+                return -TARGET_EFAULT;
+            }
+            ret = get_errno(move_mount(arg1, p2, arg3, p4, arg5));
+
+            unlock_user(p2, arg2, 0);
+            unlock_user(p4, arg4, 0);
+
+            return ret;
+        }
+#endif
 #ifdef TARGET_NR_stime /* not on alpha */
     case TARGET_NR_stime:
         {

base-commit: 81072abf1575b11226b3779af76dc71dfa85ee5d

Signature · 1 line
2.40.0
#1 lore raw

PATCH 2/2 linux-user: Add open_tree() syscall

---
 linux-user/syscall.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
linux-user/syscall.c +26 -0
index 95e370130cee..140bd2c36e0f 100644
@@ -9166,6 +9166,32 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
             return ret;
         }
 #endif
+#ifdef TARGET_NR_open_tree
+    case TARGET_NR_open_tree:
+        {
+            void *p2;
+
+            if (!arg2) {
+                return -TARGET_EFAULT;
+            }
+
+            p2 = lock_user_string(arg2);
+            if (!p2) {
+                return -TARGET_EFAULT;
+            }
+
+            int host_flags = arg3 & ~TARGET_O_CLOEXEC;
+            if (arg3 & TARGET_O_CLOEXEC) {
+                host_flags |= O_CLOEXEC;
+            }
+
+            ret = get_errno(open_tree(arg1, p2, host_flags));
+
+            unlock_user(p2, arg2, 0);
+
+            return ret;
+        }
+#endif
 #ifdef TARGET_NR_stime /* not on alpha */
     case TARGET_NR_stime:
         {
Signature · 1 line
2.40.0
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] linux-user: Add open_tree() syscall

Le 24/04/2023 à 17:34, Thomas Weißschuh a écrit :

Quoted 32 lines
---
  linux-user/syscall.c | 26 ++++++++++++++++++++++++++
  1 file changed, 26 insertions(+)
linux-user/syscall.c +19 -0
index 95e370130cee..140bd2c36e0f 100644
@@ -9166,6 +9166,32 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
              return ret;
          }
  #endif
+#ifdef TARGET_NR_open_tree
+    case TARGET_NR_open_tree:
+        {
+            void *p2;
+
+            if (!arg2) {
+                return -TARGET_EFAULT;
+            }
+
+            p2 = lock_user_string(arg2);
+            if (!p2) {
+                return -TARGET_EFAULT;
+            }
+
+            int host_flags = arg3 & ~TARGET_O_CLOEXEC;
+            if (arg3 & TARGET_O_CLOEXEC) {
+                host_flags |= O_CLOEXEC;
+            }
+

linux-user/syscall.c static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, · line 9197

Quoted 10 lines
linux-user/syscall.c +7 -0
+            ret = get_errno(open_tree(arg1, p2, host_flags));
+
+            unlock_user(p2, arg2, 0);
+
+            return ret;
+        }
+#endif
  #ifdef TARGET_NR_stime /* not on alpha */
      case TARGET_NR_stime:
          {
#3 lore raw

Re: [PATCH 2/2] linux-user: Add open_tree() syscall

In reply to Thomas Weißschuh

Le 24/04/2023 à 17:34, Thomas Weißschuh a écrit :

Quoted 32 lines
---
  linux-user/syscall.c | 26 ++++++++++++++++++++++++++
  1 file changed, 26 insertions(+)
linux-user/syscall.c +19 -0
index 95e370130cee..140bd2c36e0f 100644
@@ -9166,6 +9166,32 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
              return ret;
          }
  #endif
+#ifdef TARGET_NR_open_tree
+    case TARGET_NR_open_tree:
+        {
+            void *p2;
+
+            if (!arg2) {
+                return -TARGET_EFAULT;
+            }
+
+            p2 = lock_user_string(arg2);
+            if (!p2) {
+                return -TARGET_EFAULT;
+            }
+
+            int host_flags = arg3 & ~TARGET_O_CLOEXEC;
+            if (arg3 & TARGET_O_CLOEXEC) {
+                host_flags |= O_CLOEXEC;
+            }
+

linux-user/syscall.c static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, · line 9197

Quoted 10 lines
linux-user/syscall.c +7 -0
+            ret = get_errno(open_tree(arg1, p2, host_flags));
+
+            unlock_user(p2, arg2, 0);
+
+            return ret;
+        }
+#endif
  #ifdef TARGET_NR_stime /* not on alpha */
      case TARGET_NR_stime:
          {

Applied to my linux-user-for-8.1 branch.
(moved the variable declaration to the beginning of the block)

Thanks,
Laurent

Reviewed-by on v1 1/2
#4 lore raw
In reply to Thomas Weißschuh

Le 24/04/2023 à 17:34, Thomas Weißschuh a écrit :

Quoted 44 lines
---
  linux-user/syscall.c | 27 +++++++++++++++++++++++++++
  1 file changed, 27 insertions(+)
linux-user/syscall.c +27 -0
index 69f740ff98c8..95e370130cee 100644
@@ -9139,6 +9139,33 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
          unlock_user(p, arg1, 0);
          return ret;
  #endif
+#ifdef TARGET_NR_move_mount
+    case TARGET_NR_move_mount:
+        {
+            void *p2, *p4;
+
+            if (!arg2 || !arg4) {
+                return -TARGET_EFAULT;
+            }
+
+            p2 = lock_user_string(arg2);
+            if (!p2) {
+                return -TARGET_EFAULT;
+            }
+
+            p4 = lock_user_string(arg4);
+            if (!p4) {
+                unlock_user(p2, arg2, 0);
+                return -TARGET_EFAULT;
+            }
+            ret = get_errno(move_mount(arg1, p2, arg3, p4, arg5));
+
+            unlock_user(p2, arg2, 0);
+            unlock_user(p4, arg4, 0);
+
+            return ret;
+        }
+#endif
  #ifdef TARGET_NR_stime /* not on alpha */
      case TARGET_NR_stime:
          {
Quoted 1 line

base-commit: 81072abf1575b11226b3779af76dc71dfa85ee5d

#5 lore raw
In reply to Thomas Weißschuh

Le 24/04/2023 à 17:34, Thomas Weißschuh a écrit :

Quoted 44 lines
---
  linux-user/syscall.c | 27 +++++++++++++++++++++++++++
  1 file changed, 27 insertions(+)
linux-user/syscall.c +27 -0
index 69f740ff98c8..95e370130cee 100644
@@ -9139,6 +9139,33 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
          unlock_user(p, arg1, 0);
          return ret;
  #endif
+#ifdef TARGET_NR_move_mount
+    case TARGET_NR_move_mount:
+        {
+            void *p2, *p4;
+
+            if (!arg2 || !arg4) {
+                return -TARGET_EFAULT;
+            }
+
+            p2 = lock_user_string(arg2);
+            if (!p2) {
+                return -TARGET_EFAULT;
+            }
+
+            p4 = lock_user_string(arg4);
+            if (!p4) {
+                unlock_user(p2, arg2, 0);
+                return -TARGET_EFAULT;
+            }
+            ret = get_errno(move_mount(arg1, p2, arg3, p4, arg5));
+
+            unlock_user(p2, arg2, 0);
+            unlock_user(p4, arg4, 0);
+
+            return ret;
+        }
+#endif
  #ifdef TARGET_NR_stime /* not on alpha */
      case TARGET_NR_stime:
          {
Quoted 1 line

base-commit: 81072abf1575b11226b3779af76dc71dfa85ee5d

Applied to my linux-user-for-8.1 branch.

Thanks,
Laurent