Skip to content

verify Clang's fortified string routines are called in the kernel #1002

Closed

Description

@nickdesaulniers

forking #979 which focuses on regressions. cc @kees @gburgessiv @m-gupta
(If we're happy with a new bug, please close #979 as fixed, otherwise close this as a dup of #979).

Kees mentions that the runtime implementations of fortified string routines in the kernel may never have been called in a clang built kernel, irrespective of regressions in #979 ? If that's so, we should figure out what we need to fix and where to leverage this technology. It's probably possible to write a kselftest to help prevent support from regressing.

Activity

  1. gburgessiv commented on Apr 24, 2020

    @gburgessiv
    Member

    Thanks for filing! I hear no discomfort with #979's resolution, so I'll close it.

    Kees mentions that the runtime implementations of fortified string routines in the kernel may never have been called in a clang built kernel, irrespective of regressions in #979 ?

    This depends on the implementation of the routine in question, but yeah, clang won't generate IR for extern inline gnu_inline functions that appear trivially recursive in a particular way. This turns at least some of the kernel's FORTIFY into a nop.

    There's some discussion of approaches we can try on #980 (comment). Kees noted that automated testing would be really nice to have here before we start trying to thread this particular needle. I agree with that. :)

  2. nathanchance commented on Apr 28, 2021

    @nathanchance
    Member

    @kees had mentioned recently that he was still looking into this?

  3. kees commented on Apr 28, 2021

    @kees

    Yup, currently investigating this as a part of my memcpy work.

  4. self-assigned this
    on Apr 28, 2021
  5. kees commented on May 12, 2021

    @kees

    This is blocked on an LLVM bug: https://llvm.org/pr41459

  6. kees commented on May 12, 2021

    @kees

    And blocked on this LLVM bug: https://llvm.org/pr50322

  7. nickdesaulniers commented on Oct 19, 2021

    @nickdesaulniers
    MemberAuthor

    jotting down notes from trying to run LKDTM:

    / # mount -t sys /sys
    / # mount -t debugfs debugfs /sys/kernel/debug
    / # cat /sys/kernel/debug/provoke-crash/DIRECT
    / # echo FORTIFIED_OBJECT | cat > /sys/kernel/debug/provoke-crash/DIRECT
  8. nathanchance commented on Apr 19, 2022

    @nathanchance
    Member

    This is fixed with https://git.kernel.org/linus/281d0c962752fb40866dd8d4cade68656f34bd1f.

    #1583 is tracking the !X86_32 in CONFIG_FORTIFY_SOURCE's entry.

  9. added and removed
    questionQuestion asked by issue author.
    on Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions