FreeBSD Bugzilla – Attachment 136325 Details for
Bug 181497
[kernel] [patch] Add ASLR feature to kernel
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
aslr-2014-02-09.patch.txt
aslr-2014-02-09.patch.txt (text/plain; x-unix-mode=0644), 2.25 KB, created by
Shawn Webb
on 2014-02-10 00:37:03 UTC
(
hide
)
Description:
aslr-2014-02-09.patch.txt
Filename:
MIME Type:
Creator:
Shawn Webb
Created:
2014-02-10 00:37:03 UTC
Size:
2.25 KB
patch
obsolete
>diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c >index 3f9487c..3a36f20 100644 >--- a/sys/kern/imgact_elf.c >+++ b/sys/kern/imgact_elf.c >@@ -603,7 +603,9 @@ __elfN(load_file)(struct proc *p, const char *file, u_long *addr, > u_long rbase; > u_long base_addr = 0; > int error, i, numsegs; >- struct prison *pr; /* For ASLR */ >+#ifdef PAX_ASLR >+ struct prison *pr; >+#endif > > #ifdef CAPABILITY_MODE > /* >@@ -659,22 +661,21 @@ __elfN(load_file)(struct proc *p, const char *file, u_long *addr, > hdr = (const Elf_Ehdr *)imgp->image_header; > if ((error = __elfN(check_header)(hdr)) != 0) > goto fail; >- if (hdr->e_type == ET_DYN) >+ if (hdr->e_type == ET_DYN) { > rbase = *addr; >- else if (hdr->e_type == ET_EXEC) >+#ifdef PAX_ASLR >+ pr = pax_aslr_get_prison(NULL, imgp->proc); >+ if (pax_aslr_active(NULL, imgp->proc)) { >+ rbase += round_page(PAX_ASLR_DELTA(arc4random(), PAX_ASLR_DELTA_EXEC_LSB, pr->pr_pax_aslr_exec_len)); >+ } >+#endif >+ } else if (hdr->e_type == ET_EXEC) { > rbase = 0; >- else { >+ } else { > error = ENOEXEC; > goto fail; > } > >-#ifdef PAX_ASLR >- pr = pax_aslr_get_prison(NULL, imgp->proc); >- if (pax_aslr_active(NULL, imgp->proc)) { >- rbase += round_page(PAX_ASLR_DELTA(arc4random(), PAX_ASLR_DELTA_EXEC_LSB, pr->pr_pax_aslr_exec_len)); >- } >-#endif >- > /* Only support headers that fit within first page for now */ > if ((hdr->e_phoff > PAGE_SIZE) || > (u_int)hdr->e_phentsize * hdr->e_phnum > PAGE_SIZE - hdr->e_phoff) { >diff --git a/sys/kern/kern_pax.c b/sys/kern/kern_pax.c >index 9182606..7654e5b 100644 >--- a/sys/kern/kern_pax.c >+++ b/sys/kern/kern_pax.c >@@ -528,7 +528,6 @@ pax_aslr_init(struct thread *td, struct image_params *imgp) > vm->vm_aslr_delta_stack = PAX_ASLR_DELTA(arc4random(), > PAX_ASLR_DELTA_STACK_LSB, (pr != NULL) ? pr->pr_pax_aslr_stack_len : pax_aslr_stack_len); > vm->vm_aslr_delta_stack = ALIGN(vm->vm_aslr_delta_stack); >- vm->vm_aslr_delta_exec = round_page(PAX_ASLR_DELTA(arc4random(), PAX_ASLR_DELTA_EXEC_LSB, (pr != NULL) ? pr->pr_pax_aslr_exec_len : pax_aslr_exec_len)); > #else /* COMPAT_FREEBSD32 */ > if ((sv_flags & SV_LP64) != 0) { > vm->vm_aslr_delta_mmap = PAX_ASLR_DELTA(arc4random(),
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 181497
:
136322
|
136323
|
136324
| 136325 |
136326
|
136327
|
136328
|
153731