Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

KERNEL_SELF_PROTECTION_COMMON with clang/llvm

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
2 posts • Page 1 of 1
Author
Message
Asch
Tux's lil' helper
Tux's lil' helper
Posts: 85
Joined: Wed Jan 20, 2010 1:10 pm
Location: Nowhere special

KERNEL_SELF_PROTECTION_COMMON with clang/llvm

  • Quote

Post by Asch » Wed Jan 07, 2026 12:53 am

/usr/src/linux/distro/Kconfig wrote: if GENTOO_KERNEL_SELF_PROTECTION
config GENTOO_KERNEL_SELF_PROTECTION_COMMON
bool "Enable Kernel Self Protection Project Recommendations"

depends on GENTOO_LINUX && !SLAB_MERGE_DEFAULT && !SLUB_TINY && !COMPAT_BRK && !PROC_KCORE && !COMPAT_VDSO && !KEXEC && !HIBERNATION && !LEGACY_PTYS && !X86_X32_ABI && !MODIFY_LDT_SYSCALL && GCC_PLUGINS && !IOMMU_DEFAULT_DMA_LAZY && !IOMMU_DEFAULT_PASSTHROUGH && IOMMU_DEFAULT_DMA_STRICT && SECURITY

...
...

select RANDOMIZE_KSTACK_OFFSET_DEFAULT if HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET && (INIT_STACK_NONE || !CC_IS_CLANG || CLANG_VERSION>=140000)
It seems that GENTOO_KERNEL_SELF_PROTECTION_COMMON depends on GCC_PLUGINS, which is unavailable if you run make menuconfig with LLVM=1 and therefore plan to compile the kernel with clang/llvm. Or am I missing something subtle?

Maybe the GCC_PLUGIN requirement should be rewritten as ( GCC_PLUGINS || CLANG_VERSION>=140000 ) as in the select example above? I could easily implement this change myself, but it might be a good idea to do this upstream as well.



BTW, enabling all of these selections manually for COMMON and X86_64 makes kernel compilation fail. I'm trying to pinpoint what option exactly is the culprit.
Top
pietinger
Moderator
Moderator
Posts: 6618
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Tue Feb 03, 2026 11:17 pm

Asch,

there is another method for kernel hardening besides using our GENTOO_KERNEL_SELF_PROTECTION kernel option:

Disable ... and enable everything by yourself ... you will need only the link to the KSPP page
->
https://wiki.gentoo.org/wiki/User:Pieti ... _with_KSPP
->
https://kspp.github.io/Recommended_Settings

(Of course you can omit everything related to gcc and use instead clang-related options like CONFIG_CFI_CLANG=y )
https://wiki.gentoo.org/wiki/User:Pietinger --> https://wiki.gentoo.org/wiki/User:Pieti ... _at_Gentoo
Top
Post Reply

2 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic