Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Handle misalignment in vmcmd_map_readvn and vmcmd_m...



details:   https://anonhg.NetBSD.org/src/rev/eb9ae83698bd
branches:  trunk
changeset: 474462:eb9ae83698bd
user:      ws <ws%NetBSD.org@localhost>
date:      Wed Jul 07 20:23:45 1999 +0000

description:
Handle misalignment in vmcmd_map_readvn and vmcmd_map_zero correctly.

diffstat:

 sys/kern/exec_subr.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r d51418735aa7 -r eb9ae83698bd sys/kern/exec_subr.c
--- a/sys/kern/exec_subr.c      Wed Jul 07 06:02:21 1999 +0000
+++ b/sys/kern/exec_subr.c      Wed Jul 07 20:23:45 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec_subr.c,v 1.16 1999/03/24 05:51:22 mrg Exp $       */
+/*     $NetBSD: exec_subr.c,v 1.17 1999/07/07 20:23:45 ws Exp $        */
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -206,11 +206,16 @@
        struct exec_vmcmd *cmd;
 {
        int error;
+       long diff;
 
        if (cmd->ev_len == 0)
                return(KERN_SUCCESS); /* XXXCDC: should it happen? */
        
-       cmd->ev_addr = trunc_page(cmd->ev_addr); /* required by uvm_map */
+       diff = cmd->ev_addr - trunc_page(cmd->ev_addr);
+       cmd->ev_addr -= diff;                   /* required by uvm_map */
+       cmd->ev_offset -= diff;
+       cmd->ev_len += diff;
+
        error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, 
                        round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET, 
                        UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY,
@@ -254,11 +259,15 @@
        struct exec_vmcmd *cmd;
 {
        int error;
+       long diff;
 
        if (cmd->ev_len == 0)
                return(KERN_SUCCESS); /* XXXCDC: should it happen? */
        
-       cmd->ev_addr = trunc_page(cmd->ev_addr); /* required by uvm_map */
+       diff = cmd->ev_addr - trunc_page(cmd->ev_addr);
+       cmd->ev_addr -= diff;                   /* required by uvm_map */
+       cmd->ev_len += diff;
+
        error = uvm_map(&p->p_vmspace->vm_map, &cmd->ev_addr, 
                        round_page(cmd->ev_len), NULL, UVM_UNKNOWN_OFFSET, 
                        UVM_MAPFLAG(cmd->ev_prot, UVM_PROT_ALL, UVM_INH_COPY,



Home | Main Index | Thread Index | Old Index