Index: kernel/generic/src/mm/as.c
===================================================================
--- kernel/generic/src/mm/as.c	(revision d4b55422d35d65c648d6bb91798e0f57497dc56c)
+++ kernel/generic/src/mm/as.c	(revision d0485c6a1e50e0398bb04d70d1e1ed89ea3db22a)
@@ -551,10 +551,11 @@
  * @param dst_flags_mask Destination address space area flags mask.
  *
- * @return Zero on success or ENOENT if there is no such task or
- *	   if there is no such address space area,
- *	   EPERM if there was a problem in accepting the area or
- *	   ENOMEM if there was a problem in allocating destination
- *	   address space area. ENOTSUP is returned if an attempt
- *	   to share non-anonymous address space area is detected.
+ * @return Zero on success or ENOENT if there is no such task or if there is no
+ * such address space area, EPERM if there was a problem in accepting the area
+ * or ENOMEM if there was a problem in allocating destination address space
+ * area. ENOTSUP is returned if the address space area backend does not support
+ * sharing. It can be also returned if the architecture uses virtually indexed
+ * caches and the source and destination areas start at pages with different
+ * page colors.
  */
 int as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
@@ -581,4 +582,18 @@
 	}
 	
+#if 0	/* disable the check for now */
+#ifdef CONFIG_VIRT_IDX_CACHE
+	if (PAGE_COLOR(src_area->base) != PAGE_COLOR(dst_base)) {
+		/*
+		 * Refuse to create illegal address alias.
+		 */
+		mutex_unlock(&src_area->lock);
+		mutex_unlock(&src_as->lock);
+		interrupts_restore(ipl);
+		return ENOTSUP;
+	}
+#endif /* CONFIG_VIRT_IDX_CACHE */
+#endif
+
 	if (!src_area->backend || !src_area->backend->share) {
 		/*
