Index: kernel/generic/src/mm/as.c
===================================================================
--- kernel/generic/src/mm/as.c	(revision e32720fffe177c9b6bf6489727240c59ac6a953b)
+++ kernel/generic/src/mm/as.c	(revision db3cef9f41ba1a15a45ea39c9e55155cf37ed463)
@@ -544,5 +544,5 @@
     mem_backend_data_t *backend_data, uintptr_t *base, uintptr_t bound)
 {
-	if ((*base != (uintptr_t) -1) && ((*base % PAGE_SIZE) != 0))
+	if ((*base != (uintptr_t) -1) && !IS_ALIGNED(*base, PAGE_SIZE))
 		return NULL;
 	
@@ -688,4 +688,7 @@
 int as_area_resize(as_t *as, uintptr_t address, size_t size, unsigned int flags)
 {
+	if (!IS_ALIGNED(address, PAGE_SIZE))
+		return EINVAL;
+
 	mutex_lock(&as->lock);
 	
@@ -1350,8 +1353,8 @@
  * Interrupts are assumed disabled.
  *
- * @param page   Faulting page.
- * @param access Access mode that caused the page fault (i.e.
- *               read/write/exec).
- * @param istate Pointer to the interrupted state.
+ * @param address Faulting address.
+ * @param access  Access mode that caused the page fault (i.e.
+ *                read/write/exec).
+ * @param istate  Pointer to the interrupted state.
  *
  * @return AS_PF_FAULT on page fault.
@@ -1361,6 +1364,7 @@
  *
  */
-int as_page_fault(uintptr_t page, pf_access_t access, istate_t *istate)
-{
+int as_page_fault(uintptr_t address, pf_access_t access, istate_t *istate)
+{
+	uintptr_t page = ALIGN_DOWN(address, PAGE_SIZE);
 	int rc = AS_PF_FAULT;
 
@@ -1452,6 +1456,6 @@
 		task_kill_self(true);
 	} else {
-		fault_if_from_uspace(istate, "Page fault: %p.", (void *) page);
-		panic_memtrap(istate, access, page, NULL);
+		fault_if_from_uspace(istate, "Page fault: %p.", (void *) address);
+		panic_memtrap(istate, access, address, NULL);
 	}
 	
@@ -1679,5 +1683,5 @@
 {
 	ASSERT(mutex_locked(&area->lock));
-	ASSERT(page == ALIGN_DOWN(page, PAGE_SIZE));
+	ASSERT(IS_ALIGNED(page, PAGE_SIZE));
 	ASSERT(count);
 	
@@ -1963,5 +1967,5 @@
 {
 	ASSERT(mutex_locked(&area->lock));
-	ASSERT(page == ALIGN_DOWN(page, PAGE_SIZE));
+	ASSERT(IS_ALIGNED(page, PAGE_SIZE));
 	ASSERT(count);
 	
