]> Zhao Yanbai Git Server - minix.git/commitdiff
libmagic: ignore kernel pointers on MINIX3 60/3160/1
authorDavid van Moolenbroek <david@minix3.org>
Mon, 10 Aug 2015 13:45:35 +0000 (15:45 +0200)
committerDavid van Moolenbroek <david@minix3.org>
Thu, 17 Sep 2015 17:13:03 +0000 (17:13 +0000)
Change-Id: I8830cab3d6637bae6141dc2b0e209d319703787f

minix/llvm/static/magic/magic_st.c

index dd0cd6fd3c096b6de10b4f51116f7e2d82987649..1af9f00b76e54671e6d6af16739e59d7584e40f2 100644 (file)
@@ -630,6 +630,11 @@ PRIVATE INLINE int transfer_ptr_sel_cb(_magic_selement_t *selement, _magic_sel_a
             return MAGIC_SENTRY_ANALYZE_SKIP_PATH;
         }
     }
+#ifdef __MINIX
+#define IS_KERNEL_PTR(p) (((intptr_t)(p) & 0xf0000000) == 0xf0000000) /* TODO: make this more dynamic */
+    else if (IS_KERNEL_PTR(sel_analyzed->u.ptr.value))
+        return MAGIC_SENTRY_ANALYZE_SKIP_PATH; /* Kernel-mapped pointer */
+#endif
 
     /* Pointer with violations found */
     ST_CB_PRINT(ST_CB_ERR, "uncaught ptr with violations", selement, sel_analyzed, sel_stats, cb_info);