分类: LINUX
2013-01-17 12:02:19
/* The functions which has first parameter gfp_t. 第一个参数为gfp_t的函数,分为两类切点ARG_1和ARG_2_1. __get_free_pages()*/ /*切点ARG_1,表示程序中具有如下三个特征之一的地方:调用返回值为unsigned long的__get_free_pages方法(不考虑参数个数);运行方法体static inline struct page * alloc_pages(..); 调用 struct *page *alloc_page_vma(..). */ pointcut ARG_1: call(unsigned long (..)) || execution(static inline struct page *(..)) || call(struct page *(..)) /*切点ARG_2_1, 表示程序中具有如下特征之一的部分:1,运行方法 static inline void *kmalloc(..); 2,运行方法static inline struct sk_buff *alloc_skb(..); 3,运行方法static inline struct sk_buff *alloc_skb_fclone(..). ......*/ pointcut ARG_2_1: execution(static inline void *(..)) || execution(static inline struct sk_buff *alloc_skb(..)) || execution(static inline struct sk_buff *alloc_skb_fclone(..)) || call(struct sk_buff *skb_copy(..)) || execution(static inline struct sk_buff *skb_share_check(..)) || call(struct sk_buff *skb_clone(..)) || execution(static inline struct sk_buff *skb_unshare(..)) /* __dev_alloc_skb calls alloc_skb so we don't need to instrument it. */ || execution(static inline struct page *__netdev_alloc_page(..)) || call(int usb_submit_urb(..)) || call(struct urb *usb_alloc_urb(..)) /* This is rather optional for SLAB memory subsystem, just for SLUB. */ || execution(static inline void *kmalloc_node(..)) /* This function isn't static inline and has no body to be instrumented among related to a driver files. So instrument calls to it. */ || call(void *kmem_cache_alloc(..)) || call(void *mempool_alloc(..)) || call(void *dma_pool_alloc(..)) /* Separate weaving of kzalloc bacause it should not call kmalloc in the body */ pointcut ARG_2_2: execution(static inline void *(..)) || execution(static inline void *kzalloc_node(..)) || execution(static inline void *kmem_cache_zalloc(..)) /* Separate this set of functions from the above one since they has third parameter gfp_t. */ pointcut ARG_3: execution(static inline void *(..)) || call(void * krealloc(..)) || call(struct sk_buff *__netdev_alloc_skb(..)) || call(void *usb_alloc_coherent(..)) || call(int mempool_resize(..)) /* The functions that has fourth parameter gfp_t. */ pointcut ARG_4: call(int (..))/*skb is 'socket buffer'*/ || call(struct sk_buff *skb_copy_expand(..)) || execution(static inline void *dma_zalloc_coherent(..)) || execution(static inline void *dma_alloc_coherent(..)) /* The functions without parameter gfp_t. Implicit flag GFP_KERNEL.没有参数gfp_t,默认GFP_KERNEL*/ pointcut ARG_0: call(void *(..)) || call(void *(..)) || call(void *(..)) || call(void *vmalloc_node(..)) || call(void *vzalloc_node(..)) || call(void *vmalloc_exec(..)) || call(void *vmalloc_32(..)) || call(void *vmalloc_32_user(..)) pointcut alloc_pages: define((gfp_mask, order)) pointcut alloc_page_vma: define((gfp_mask, vma, addr))