summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2022-08-28 02:49:24 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-08-28 02:49:24 +0200
commit222aee5ef5885dbe5b5b39c59495f9e3f22f864d (patch)
treeee135659ea8d842c74dc5992042cb320573de9f4 /kern
parent5013a77a1ec2008d033297716ad4e27c9f1d48b8 (diff)
Fix 64-to-32 copyout
We cannot assume that the processor is little-endian.
Diffstat (limited to 'kern')
-rw-r--r--kern/bootstrap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index 259821ae..61f179cf 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -583,7 +583,7 @@ build_args_and_stack(struct exec_info *boot_exec_info,
char * arg_pos;
int arg_item_len;
char * string_pos;
- char * zero = (char *)0;
+ rpc_vm_offset_t zero = 0;
int i;
#define STACK_SIZE (2*64*1024)
@@ -647,11 +647,12 @@ build_args_and_stack(struct exec_info *boot_exec_info,
* Then the strings and string pointers for each argument
*/
for (i = 0; i < arg_count; ++i) {
+ rpc_vm_offset_t pos = convert_vm_to_user((vm_offset_t) string_pos);
arg_ptr = argv[i];
arg_item_len = strlen(arg_ptr) + 1; /* include trailing 0 */
/* set string pointer */
- (void) copyout(&string_pos, arg_pos, sizeof (rpc_vm_offset_t));
+ (void) copyout(&pos, arg_pos, sizeof (rpc_vm_offset_t));
arg_pos += sizeof(rpc_vm_offset_t);
/* copy string */
@@ -669,11 +670,12 @@ build_args_and_stack(struct exec_info *boot_exec_info,
* Then the strings and string pointers for each environment variable
*/
for (i = 0; i < envc; ++i) {
+ rpc_vm_offset_t pos = convert_vm_to_user((vm_offset_t) string_pos);
arg_ptr = envp[i];
arg_item_len = strlen(arg_ptr) + 1; /* include trailing 0 */
/* set string pointer */
- (void) copyout(&string_pos, arg_pos, sizeof (rpc_vm_offset_t));
+ (void) copyout(&pos, arg_pos, sizeof (rpc_vm_offset_t));
arg_pos += sizeof(rpc_vm_offset_t);
/* copy string */