socsvn commit: r272128 - in soc2014/op/freebsd-base/sys: amd64/amd64 kern
op at FreeBSD.org
op at FreeBSD.org
Sat Aug 9 15:32:26 UTC 2014
Author: op
Date: Sat Aug 9 15:32:25 2014
New Revision: 272128
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272128
Log:
KSP SMAP: fix alert message in trap, and removed unused code
Signed-off-by: Oliver Pinter <oliver.pntr at gmail.com>
git: https://github.com/opntr/opBSD/tree/op/gsoc2014/smap+kpatch
Modified:
soc2014/op/freebsd-base/sys/amd64/amd64/trap.c
soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c
Modified: soc2014/op/freebsd-base/sys/amd64/amd64/trap.c
==============================================================================
--- soc2014/op/freebsd-base/sys/amd64/amd64/trap.c Sat Aug 9 14:33:44 2014 (r272127)
+++ soc2014/op/freebsd-base/sys/amd64/amd64/trap.c Sat Aug 9 15:32:25 2014 (r272128)
@@ -705,7 +705,7 @@
* value of EFLAGS.AC." - Intel Ref. # 319433-014 9.3.2
*/
if (__predict_false(smap_access_violation(frame, usermode))) {
- printf("Supervisor Mode Access Prevention\n");
+ printf("\nSupervisor Mode Access Prevention\n");
trap_fatal(frame, eva);
return(-1);
}
Modified: soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c
==============================================================================
--- soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c Sat Aug 9 14:33:44 2014 (r272127)
+++ soc2014/op/freebsd-base/sys/kern/kern_selfpatch.c Sat Aug 9 15:32:25 2014 (r272128)
@@ -158,11 +158,7 @@
void
lf_selfpatch_apply(linker_file_t lf, struct lf_selfpatch *p)
{
-#if 0
- vm_paddr_t *pages;
-#else
vm_paddr_t pages[4];
-#endif
vm_offset_t page_offset;
int i, page_number;
@@ -187,12 +183,10 @@
page_number = (p->patchable_size >> PAGE_SHIFT) +
((page_offset + p->patchable_size) > PAGE_SIZE ? 2 : 1);
-#if 0
- pages = malloc(page_number, M_TEMP, M_WAITOK | M_ZERO);
-#else
+ DBG("page_number: %d\n", page_number);
+
KASSERT(page_number < 4,
("patch size longer than 3 page does not supported yet\n"));
-#endif
DBG("change mapping attribute from RX to RWX:\n");
for (i=0; i<page_number; i++) {
@@ -200,6 +194,8 @@
kva = trunc_page(p->patchable) + i * PAGE_SIZE;
pages[i] = pmap_kextract(kva);
+
+ DBG("kva: %p page: %p\n", (void *)kva, (void *)pages[i]);
pmap_kenter_attr(kva, pages[i], VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE);
}
DBG("done.\n");
@@ -216,10 +212,6 @@
pmap_kenter_attr(kva, pages[i], VM_PROT_READ | VM_PROT_EXECUTE);
}
DBG("done.\n");
-
-#if 0
- free(pages, M_TEMP);
-#endif
}
void
More information about the svn-soc-all
mailing list