bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 03/15] fix argument passing to bootstrap modules


From: Luca Dariz
Subject: [PATCH 03/15] fix argument passing to bootstrap modules
Date: Tue, 28 Jun 2022 12:10:42 +0200

* kern/bootstrap.c: use rpc_ vm types to put the bootstrap module
  arguments on the stack, make it consistent with user-space types.

Signed-off-by: Luca Dariz <luca@orpolo.org>
---
 kern/bootstrap.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index 60648c9d..259821ae 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -612,7 +612,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
         *      and align to integer boundary
         */
        arg_len += (sizeof(integer_t)
-                   + (arg_count + 1 + envc + 1) * sizeof(char *));
+                   + (arg_count + 1 + envc + 1) * sizeof(rpc_vm_offset_t));
        arg_len = (arg_len + sizeof(integer_t) - 1) & ~(sizeof(integer_t)-1);
 
        /*
@@ -633,7 +633,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
         */
        string_pos = (arg_pos
                      + sizeof(integer_t)
-                     + (arg_count + 1 + envc + 1) * sizeof(char *));
+                     + (arg_count + 1 + envc + 1) * sizeof(rpc_vm_offset_t));
 
        /*
         * first the argument count
@@ -651,10 +651,8 @@ build_args_and_stack(struct exec_info *boot_exec_info,
            arg_item_len = strlen(arg_ptr) + 1; /* include trailing 0 */
 
            /* set string pointer */
-           (void) copyout(&string_pos,
-                       arg_pos,
-                       sizeof (char *));
-           arg_pos += sizeof(char *);
+            (void) copyout(&string_pos, arg_pos, sizeof (rpc_vm_offset_t));
+           arg_pos += sizeof(rpc_vm_offset_t);
 
            /* copy string */
            (void) copyout(arg_ptr, string_pos, arg_item_len);
@@ -664,8 +662,8 @@ build_args_and_stack(struct exec_info *boot_exec_info,
        /*
         * Null terminator for argv.
         */
-       (void) copyout(&zero, arg_pos, sizeof(char *));
-       arg_pos += sizeof(char *);
+       (void) copyout(&zero, arg_pos, sizeof(rpc_vm_offset_t));
+       arg_pos += sizeof(rpc_vm_offset_t);
 
        /*
         * Then the strings and string pointers for each environment variable
@@ -675,10 +673,8 @@ build_args_and_stack(struct exec_info *boot_exec_info,
            arg_item_len = strlen(arg_ptr) + 1; /* include trailing 0 */
 
            /* set string pointer */
-           (void) copyout(&string_pos,
-                       arg_pos,
-                       sizeof (char *));
-           arg_pos += sizeof(char *);
+            (void) copyout(&string_pos, arg_pos, sizeof (rpc_vm_offset_t));
+           arg_pos += sizeof(rpc_vm_offset_t);
 
            /* copy string */
            (void) copyout(arg_ptr, string_pos, arg_item_len);
@@ -688,7 +684,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
        /*
         * Null terminator for envp.
         */
-       (void) copyout(&zero, arg_pos, sizeof(char *));
+       (void) copyout(&zero, arg_pos, sizeof(rpc_vm_offset_t));
 }
 
 
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]