lkml.org 
[lkml]   [2021]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[PATCH 06/43] asm-generic: instrument usercopy in cacheflush.h
    From
    Notify memory tools about usercopy events in copy_to_user_page() and
    copy_from_user_page().

    Signed-off-by: Alexander Potapenko <glider@google.com>
    ---
    Link: https://linux-review.googlesource.com/id/Ic1ee8da1886325f46ad67f52176f48c2c836c48f
    ---
    include/asm-generic/cacheflush.h | 9 ++++++++-
    1 file changed, 8 insertions(+), 1 deletion(-)

    diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h
    index 4f07afacbc239..0f63eb325025f 100644
    --- a/include/asm-generic/cacheflush.h
    +++ b/include/asm-generic/cacheflush.h
    @@ -2,6 +2,8 @@
    #ifndef _ASM_GENERIC_CACHEFLUSH_H
    #define _ASM_GENERIC_CACHEFLUSH_H

    +#include <linux/instrumented.h>
    +
    struct mm_struct;
    struct vm_area_struct;
    struct page;
    @@ -105,6 +107,7 @@ static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
    #ifndef copy_to_user_page
    #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
    do { \
    + instrument_copy_to_user(dst, src, len); \
    memcpy(dst, src, len); \
    flush_icache_user_page(vma, page, vaddr, len); \
    } while (0)
    @@ -112,7 +115,11 @@ static inline void flush_cache_vunmap(unsigned long start, unsigned long end)

    #ifndef copy_from_user_page
    #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
    - memcpy(dst, src, len)
    + do { \
    + instrument_copy_from_user_before(dst, src, len); \
    + memcpy(dst, src, len); \
    + instrument_copy_from_user_after(dst, src, len, 0); \
    + } while (0)
    #endif

    #endif /* _ASM_GENERIC_CACHEFLUSH_H */
    --
    2.34.1.173.g76aa8bc2d0-goog
    \
     
     \ /
      Last update: 2021-12-14 17:23    [W:3.690 / U:0.792 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site