Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't remove -ffreestanding from i386 #1583

Open
nickdesaulniers opened this issue Feb 8, 2022 · 4 comments
Open

can't remove -ffreestanding from i386 #1583

nickdesaulniers opened this issue Feb 8, 2022 · 4 comments
Assignees
Labels
[ARCH] x86 This bug impacts ARCH=i386 [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 15 This bug was fixed in LLVM 15.x Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list.

Comments

@nickdesaulniers
Copy link
Member

@kees was looking to use an old patch of mine to get FORTIFY_SOURCE working for ARCH=i386 LLVM=1 builds. We got a report that this caused kernel panics. I traced this to a bug in LLVM, reported upstream.

@nickdesaulniers nickdesaulniers added [BUG] llvm A bug that should be fixed in upstream LLVM [ARCH] x86 This bug impacts ARCH=i386 Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list. labels Feb 8, 2022
@nickdesaulniers nickdesaulniers self-assigned this Feb 8, 2022
@nickdesaulniers nickdesaulniers added the low priority This bug is not critical and not a priority label Feb 10, 2022
@nickdesaulniers nickdesaulniers removed their assignment Feb 10, 2022
@nickdesaulniers
Copy link
Member Author

https://lore.kernel.org/lkml/164934565464.389.2546833245037255032.tip-bot2@tip-bot2/
Look's like meat's back on the menu, boys.

@nickdesaulniers
Copy link
Member Author

Note to self:
-mregparm=3 ends up:

  1. setting the inreg parameter attribute, and
  2. setting the !{i32 1, !"NumRegisterParameters", i32 3 module attribute.

@nickdesaulniers
Copy link
Member Author

@nickdesaulniers nickdesaulniers self-assigned this May 10, 2022
@nickdesaulniers nickdesaulniers added the [FIXED][LLVM] 15 This bug was fixed in LLVM 15.x label May 10, 2022
@nickdesaulniers
Copy link
Member Author

nickdesaulniers commented May 10, 2022

Waiting on backport in llvm/llvm-project#53645 (comment).

I tested this quickly:

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 63d50f65b828..8da13220afa0 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -101,7 +101,7 @@ ifeq ($(CONFIG_X86_32),y)
         KBUILD_CFLAGS += $(cflags-y)
 
         # temporary until string.h is fixed
-        KBUILD_CFLAGS += -ffreestanding
+        #KBUILD_CFLAGS += -ffreestanding
 
        ifeq ($(CONFIG_STACKPROTECTOR),y)
                ifeq ($(CONFIG_SMP),y)
diff --git a/security/Kconfig b/security/Kconfig
index 9b2c4925585a..a916640970f7 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -179,8 +179,6 @@ config FORTIFY_SOURCE
        depends on ARCH_HAS_FORTIFY_SOURCE
        # https://bugs.llvm.org/show_bug.cgi?id=41459
        depends on !CC_IS_CLANG || CLANG_VERSION >= 120001
-       # https://github.com/llvm/llvm-project/issues/53645
-       depends on !CC_IS_CLANG || !X86_32
        help
          Detect overflows of buffers in common string and memory functions
          where the compiler can determine and validate the buffer sizes.

with ARCH=i386 make LLVM=1 -j72 and thinLTO. I should do version checks for these instead in a more formal kernel patch (but not today 😴 )

clang-15 it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[ARCH] x86 This bug impacts ARCH=i386 [BUG] llvm A bug that should be fixed in upstream LLVM [FIXED][LLVM] 15 This bug was fixed in LLVM 15.x Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list.
Projects
None yet
Development

No branches or pull requests

1 participant