Don't try to map a 0 size bss.

This commit is contained in:
christos 2005-01-30 23:59:57 +00:00
parent 842f22fc3a
commit 0b71a2d5de
5 changed files with 34 additions and 28 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_exec.c,v 1.11 2003/11/19 15:48:21 christos Exp $ */
/* $NetBSD: compat_exec.c,v 1.12 2005/01/30 23:59:57 christos Exp $ */
/*
* Copyright (c) 1993, 1994 Christopher G. Demetriou
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: compat_exec.c,v 1.11 2003/11/19 15:48:21 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: compat_exec.c,v 1.12 2005/01/30 23:59:57 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -79,9 +79,10 @@ exec_aout_prep_oldzmagic(p, epp)
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
/* set up command for bss segment */
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
if (execp->a_bss)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
return (*epp->ep_esch->es_setup_stack)(p, epp);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec_aout.c,v 1.55 2003/08/08 18:57:06 christos Exp $ */
/* $NetBSD: linux_exec_aout.c,v 1.56 2005/01/30 23:59:57 christos Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.55 2003/08/08 18:57:06 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.56 2005/01/30 23:59:57 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -201,9 +201,10 @@ exec_linux_aout_prep_zmagic(p, epp)
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
/* set up command for bss segment */
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
if (execp->a_bss)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
return (*epp->ep_esch->es_setup_stack)(p, epp);
}
@ -321,9 +322,10 @@ exec_linux_aout_prep_qmagic(p, epp)
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
/* set up command for bss segment */
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
if (execp->a_bss)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
return (*epp->ep_esch->es_setup_stack)(p, epp);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: m68k4k_exec.c,v 1.14 2003/08/08 18:57:06 christos Exp $ */
/* $NetBSD: m68k4k_exec.c,v 1.15 2005/01/30 23:59:58 christos Exp $ */
/*
* Copyright (c) 1993, 1994 Christopher G. Demetriou
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: m68k4k_exec.c,v 1.14 2003/08/08 18:57:06 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: m68k4k_exec.c,v 1.15 2005/01/30 23:59:58 christos Exp $");
#if !defined(__m68k__)
#error YOU GOTTA BE KIDDING!
@ -155,9 +155,10 @@ exec_m68k4k_prep_zmagic(p, epp)
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
/* set up command for bss segment */
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
if (execp->a_bss)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
return (*epp->ep_esch->es_setup_stack)(p, epp);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pecoff_exec.c,v 1.25 2004/07/18 04:36:42 kent Exp $ */
/* $NetBSD: pecoff_exec.c,v 1.26 2005/01/30 23:59:58 christos Exp $ */
/*
* Copyright (c) 2000 Masaru OKI
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pecoff_exec.c,v 1.25 2004/07/18 04:36:42 kent Exp $");
__KERNEL_RCSID(0, "$NetBSD: pecoff_exec.c,v 1.26 2005/01/30 23:59:58 christos Exp $");
/*#define DEBUG_PECOFF*/
@ -483,9 +483,10 @@ exec_pecoff_prep_zmagic(p, epp, fp, ap, peofs)
/* set up command for bss segment */
baddr = sh[i].s_vaddr;
bsize = sh[i].s_paddr;
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero,
bsize, baddr, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
if (bsize)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero,
bsize, baddr, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
epp->ep_daddr = min(epp->ep_daddr, baddr);
bsize = baddr + bsize - epp->ep_daddr;
epp->ep_dsize = max(epp->ep_dsize, bsize);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos_exec_aout.c,v 1.11 2003/08/08 18:57:07 christos Exp $ */
/* $NetBSD: sunos_exec_aout.c,v 1.12 2005/01/30 23:59:58 christos Exp $ */
/*
* Copyright (c) 1993 Theo de Raadt
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sunos_exec_aout.c,v 1.11 2003/08/08 18:57:07 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: sunos_exec_aout.c,v 1.12 2005/01/30 23:59:58 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -143,9 +143,10 @@ sunos_exec_aout_prep_zmagic(p, epp)
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
/* set up command for bss segment */
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
if (execp->a_bss)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
return (*epp->ep_esch->es_setup_stack)(p, epp);
}