MFC: sys/amd64/linux32/linux32_machdep.c 1.46
sys/i386/linux/linux_machdep.c 1.80 Fix Linux mmap with MAP_GROWSDOWN flag.
This commit is contained in:
parent
926347d060
commit
e5908a9796
@ -720,21 +720,22 @@ linux_mmap_common(struct thread *td, struct l_mmap_argv *linux_args)
|
||||
PROC_UNLOCK(p);
|
||||
}
|
||||
|
||||
/* This gives us our maximum stack size */
|
||||
if (linux_args->len > STACK_SIZE - GUARD_SIZE)
|
||||
bsd_args.len = linux_args->len;
|
||||
else
|
||||
bsd_args.len = STACK_SIZE - GUARD_SIZE;
|
||||
|
||||
/*
|
||||
* This gives us a new BOS. If we're using VM_STACK, then
|
||||
* mmap will just map the top SGROWSIZ bytes, and let
|
||||
* the stack grow down to the limit at BOS. If we're
|
||||
* not using VM_STACK we map the full stack, since we
|
||||
* don't have a way to autogrow it.
|
||||
* This gives us our maximum stack size and a new BOS.
|
||||
* If we're using VM_STACK, then mmap will just map
|
||||
* the top SGROWSIZ bytes, and let the stack grow down
|
||||
* to the limit at BOS. If we're not using VM_STACK
|
||||
* we map the full stack, since we don't have a way
|
||||
* to autogrow it.
|
||||
*/
|
||||
bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) -
|
||||
bsd_args.len;
|
||||
if (linux_args->len > STACK_SIZE - GUARD_SIZE) {
|
||||
bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
|
||||
bsd_args.len = linux_args->len;
|
||||
} else {
|
||||
bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) -
|
||||
(STACK_SIZE - GUARD_SIZE - linux_args->len);
|
||||
bsd_args.len = STACK_SIZE - GUARD_SIZE;
|
||||
}
|
||||
} else {
|
||||
bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
|
||||
bsd_args.len = linux_args->len;
|
||||
|
@ -570,21 +570,22 @@ linux_mmap_common(struct thread *td, struct l_mmap_argv *linux_args)
|
||||
PROC_UNLOCK(p);
|
||||
}
|
||||
|
||||
/* This gives us our maximum stack size */
|
||||
if (linux_args->len > STACK_SIZE - GUARD_SIZE)
|
||||
bsd_args.len = linux_args->len;
|
||||
else
|
||||
bsd_args.len = STACK_SIZE - GUARD_SIZE;
|
||||
|
||||
/*
|
||||
* This gives us a new BOS. If we're using VM_STACK, then
|
||||
* mmap will just map the top SGROWSIZ bytes, and let
|
||||
* the stack grow down to the limit at BOS. If we're
|
||||
* not using VM_STACK we map the full stack, since we
|
||||
* don't have a way to autogrow it.
|
||||
/*
|
||||
* This gives us our maximum stack size and a new BOS.
|
||||
* If we're using VM_STACK, then mmap will just map
|
||||
* the top SGROWSIZ bytes, and let the stack grow down
|
||||
* to the limit at BOS. If we're not using VM_STACK
|
||||
* we map the full stack, since we don't have a way
|
||||
* to autogrow it.
|
||||
*/
|
||||
bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) -
|
||||
bsd_args.len;
|
||||
if (linux_args->len > STACK_SIZE - GUARD_SIZE) {
|
||||
bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
|
||||
bsd_args.len = linux_args->len;
|
||||
} else {
|
||||
bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) -
|
||||
(STACK_SIZE - GUARD_SIZE - linux_args->len);
|
||||
bsd_args.len = STACK_SIZE - GUARD_SIZE;
|
||||
}
|
||||
} else {
|
||||
bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
|
||||
bsd_args.len = linux_args->len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user