• Kees Cook's avatar
    lib/string: Move helper functions out of string.c · cfecea6e
    Kees Cook authored
    The core functions of string.c are those that may be implemented by
    per-architecture functions, or overloaded by FORTIFY_SOURCE. As a
    result, it needs to be built with __NO_FORTIFY. Without this, macros
    will collide with function declarations. This was accidentally working
    due to -ffreestanding (on some architectures). Make this deterministic
    by explicitly setting __NO_FORTIFY and move all the helper functions
    into string_helpers.c so that they gain the fortification coverage they
    had been missing.
    
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Andy Lavr <andy.lavr@gmail.com>
    Cc: Nathan Chancellor <nathan@kernel.org>
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Cc: Stephen Rothwell <sfr@canb.auug.org.au>
    Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
    Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    cfecea6e
string.c 7.84 KB