From: David van Moolenbroek Date: Mon, 10 Aug 2015 13:45:35 +0000 (+0200) Subject: libmagic: ignore kernel pointers on MINIX3 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/static/doc/zpipe.c?a=commitdiff_plain;h=c8f69861858b605a46afcc194b64a11dadcbdb21;p=minix.git libmagic: ignore kernel pointers on MINIX3 Change-Id: I8830cab3d6637bae6141dc2b0e209d319703787f --- diff --git a/minix/llvm/static/magic/magic_st.c b/minix/llvm/static/magic/magic_st.c index dd0cd6fd3..1af9f00b7 100644 --- a/minix/llvm/static/magic/magic_st.c +++ b/minix/llvm/static/magic/magic_st.c @@ -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);