rename DEBUG_ASLR -> PAX_ASLR_DEBUG
This commit is contained in:
parent
9109db5aef
commit
724aa20200
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files,v 1.982 2010/03/13 08:33:26 darran Exp $
|
||||
# $NetBSD: files,v 1.983 2010/03/15 20:35:19 christos Exp $
|
||||
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
|
||||
|
||||
version 20090313
|
||||
|
@ -109,6 +109,7 @@ defparam opt_pax.h PAX_MPROTECT
|
|||
PAX_ASLR_DELTA_STACK_LSB
|
||||
PAX_ASLR_DELTA_STACK_LEN
|
||||
PAX_ASLR_DELTA_PROG_LEN
|
||||
PAX_ASLR_DEBUG
|
||||
|
||||
defflag opt_fileassoc.h FILEASSOC
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: exec_elf.c,v 1.13 2010/02/22 19:46:18 drochner Exp $ */
|
||||
/* $NetBSD: exec_elf.c,v 1.14 2010/03/15 20:35:20 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
|
||||
|
@ -57,7 +57,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.13 2010/02/22 19:46:18 drochner Exp $");
|
||||
__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.14 2010/03/15 20:35:20 christos Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_pax.h"
|
||||
|
@ -139,18 +139,18 @@ pax_aslr_elf(struct lwp *l, struct exec_package *epp, Elf_Ehdr *eh,
|
|||
|
||||
if (pax_align == 0)
|
||||
pax_align = PGSHIFT;
|
||||
#ifdef DEBUG_ASLR
|
||||
#ifdef PAX_ASLR_DEBUG
|
||||
uprintf("r=0x%x a=0x%x p=0x%x Delta=0x%lx\n", r,
|
||||
ilog2(pax_align), PGSHIFT, PAX_ASLR_DELTA(r,
|
||||
ilog2(pax_align), PAX_ASLR_DELTA_EXEC_LEN));
|
||||
#endif
|
||||
pax_offset = ELF_TRUNC(PAX_ASLR_DELTA(r,
|
||||
ilog2(pax_align), PAX_ASLR_DELTA_EXEC_LEN), pax_align);
|
||||
ilog2(pax_align), PAX_ASLR_DELTA_EXEC_LEN), pax_align) + PAGE_SIZE;
|
||||
|
||||
for (i = 0; i < eh->e_phnum; i++)
|
||||
ph[i].p_vaddr += pax_offset;
|
||||
eh->e_entry += pax_offset;
|
||||
#ifdef DEBUG_ASLR
|
||||
#ifdef PAX_ASLR_DEBUG
|
||||
uprintf("pax offset=0x%zx entry=0x%llx\n",
|
||||
pax_offset, (unsigned long long)eh->e_entry);
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_pax.c,v 1.22 2008/06/04 12:26:20 ad Exp $ */
|
||||
/* $NetBSD: kern_pax.c,v 1.23 2010/03/15 20:35:20 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Elad Efrat <elad@NetBSD.org>
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.22 2008/06/04 12:26:20 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.23 2010/03/15 20:35:20 christos Exp $");
|
||||
|
||||
#include "opt_pax.h"
|
||||
|
||||
|
@ -321,7 +321,7 @@ pax_aslr(struct lwp *l, vaddr_t *addr, vaddr_t orig_addr, int f)
|
|||
return;
|
||||
|
||||
if (!(f & MAP_FIXED) && ((orig_addr == 0) || !(f & MAP_ANON))) {
|
||||
#ifdef DEBUG_ASLR
|
||||
#ifdef PAX_ASLR_DEBUG
|
||||
uprintf("applying to 0x%lx orig_addr=0x%lx f=%x\n",
|
||||
(unsigned long)*addr, (unsigned long)orig_addr, f);
|
||||
#endif
|
||||
|
@ -329,11 +329,11 @@ pax_aslr(struct lwp *l, vaddr_t *addr, vaddr_t orig_addr, int f)
|
|||
*addr += l->l_proc->p_vmspace->vm_aslr_delta_mmap;
|
||||
else
|
||||
*addr -= l->l_proc->p_vmspace->vm_aslr_delta_mmap;
|
||||
#ifdef DEBUG_ASLR
|
||||
#ifdef PAX_ASLR_DEBUG
|
||||
uprintf("result 0x%lx\n", *addr);
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG_ASLR
|
||||
#ifdef PAX_ASLR_DEBUG
|
||||
else
|
||||
uprintf("not applying to 0x%lx orig_addr=0x%lx f=%x\n",
|
||||
(unsigned long)*addr, (unsigned long)orig_addr, f);
|
||||
|
@ -347,7 +347,7 @@ pax_aslr_stack(struct lwp *l, struct exec_package *epp, u_long *max_stack_size)
|
|||
u_long d = PAX_ASLR_DELTA(arc4random(),
|
||||
PAX_ASLR_DELTA_STACK_LSB,
|
||||
PAX_ASLR_DELTA_STACK_LEN);
|
||||
#ifdef DEBUG_ASLR
|
||||
#ifdef PAX_ASLR_DEBUG
|
||||
uprintf("stack 0x%lx d=0x%lx 0x%lx\n",
|
||||
epp->ep_minsaddr, d, epp->ep_minsaddr - d);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue