lkml.org 
[lkml]   [2022]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 1/4] lib/strn*,objtool: Enforce user_access_begin() rules
    Apparently GCC can fail to inline a 'static inline' single caller
    function:

    lib/strnlen_user.o: warning: objtool: strnlen_user()+0x33: call to do_strnlen_user() with UACCESS enabled
    lib/strncpy_from_user.o: warning: objtool: strncpy_from_user()+0x33: call to do_strncpy_from_user() with UACCESS enabled

    Reported-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    ---
    lib/strncpy_from_user.c | 2 +-
    lib/strnlen_user.c | 2 +-
    2 files changed, 2 insertions(+), 2 deletions(-)

    --- a/lib/strncpy_from_user.c
    +++ b/lib/strncpy_from_user.c
    @@ -25,7 +25,7 @@
    * hit it), 'max' is the address space maximum (and we return
    * -EFAULT if we hit it).
    */
    -static inline long do_strncpy_from_user(char *dst, const char __user *src,
    +static __always_inline long do_strncpy_from_user(char *dst, const char __user *src,
    unsigned long count, unsigned long max)
    {
    const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS;
    --- a/lib/strnlen_user.c
    +++ b/lib/strnlen_user.c
    @@ -20,7 +20,7 @@
    * if it fits in a aligned 'long'. The caller needs to check
    * the return value against "> max".
    */
    -static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max)
    +static __always_inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max)
    {
    const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS;
    unsigned long align, res = 0;

    \
     
     \ /
      Last update: 2022-04-08 11:49    [W:7.955 / U:1.384 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site