• Kees Cook's avatar
    fortify: Provide a memcpy trap door for sharp corners · 43213dae
    Kees Cook authored
    As we continue to narrow the scope of what the FORTIFY memcpy() will
    accept and build alternative APIs that give the compiler appropriate
    visibility into more complex memcpy scenarios, there is a need for
    "unfortified" memcpy use in rare cases where combinations of compiler
    behaviors, source code layout, etc, result in cases where the stricter
    memcpy checks need to be bypassed until appropriate solutions can be
    developed (i.e. fix compiler bugs, code refactoring, new API, etc). The
    intention is for this to be used only if there's no other reasonable
    solution, for its use to include a justification that can be used
    to assess future solutions, and for it to be temporary.
    
    Example usage included, based on analysis and discussion from:
    https://lore.kernel.org/netdev/CANn89iLS_2cshtuXPyNUGDPaic=sJiYfvTb_wNLgWrZRyBxZ_g@mail.gmail.com
    
    Cc: Jakub Kicinski <kuba@kernel.org>
    Cc: Eric Dumazet <edumazet@google.com>
    Cc: "David S. Miller" <davem@davemloft.net>
    Cc: Paolo Abeni <pabeni@redhat.com>
    Cc: Coco Li <lixiaoyan@google.com>
    Cc: Tariq Toukan <tariqt@nvidia.com>
    Cc: Saeed Mahameed <saeedm@nvidia.com>
    Cc: Leon Romanovsky <leon@kernel.org>
    Cc: netdev@vger.kernel.org
    Cc: linux-hardening@vger.kernel.org
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/r/20220511025301.3636666-1-keescook@chromium.orgSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    43213dae
string.h 9.29 KB