Skip to content
Corvidae-Coding-ProjectsPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

HDN Linux kernel patch

This repository publishes HDN Linux kernel-hardening patches for the generic upstream Linux 7.0.12 source tree and three vendor source families. It is the public release-artifact repository; kernel development happens elsewhere.

HDN is an independent implementation with its own policy model, interfaces, tests, and source structure. It is not source-, configuration-, or ABI-compatible with grsecurity or PaX.

Vendor-specific patches

These patches include the current HDN source, the persistent exec-after-write history fix, guarded read-only-filesystem transaction cancellation, native vendor adaptations, and the current optional RAP/private-stack work.

Exact target source Patch SHA-256
Ubuntu 26.04, Linux 7.0.14 hdn-linux-7.0.14-ubuntu-26.04.patch 7001a7f5168d1c81c3e0051631b923df46239d63f6e0ceecad373270d2c7f181
Ubuntu 24.04 HWE, Linux 7.0.14, GitLab variant hdn-linux-7.0.14-ubuntu-24.04-hwe-gitlab.patch d5aa5f1ff507910bcc2a19c8e400cfde76d47d3bad8cd6bc1f9fa69d41b1e893
Debian, Linux 7.3.1, Wazuh variant hdn-linux-7.3.1-debian-wazuh.patch 7ce66c879efd66c09a627d97b714a7543aff88c015c9875a18237a1a785b72d2

The patches are not interchangeable. Use only the patch matching the exact vendor family and version. Do not force rejected or offset hunks onto a different revision.

From the root of an unmodified matching source tree, verify the repository and preflight the selected patch:

sha256sum -c /path/to/hdn-patch/SHA256SUMS

git apply --check --whitespace=nowarn \
  /path/to/hdn-patch/the-matching-vendor.patch
git apply --whitespace=nowarn \
  /path/to/hdn-patch/the-matching-vendor.patch

--whitespace=nowarn preserves inherited vendor/upstream whitespace; it does not permit fuzzy or rejected hunks. Each published patch was independently replayed against a fresh copy of its pinned baseline, and the result matched the pinned target source tree byte-for-byte, including file modes and symlinks.

Configure a vendor kernel

Begin with the vendor's configuration for that exact kernel. Enable CONFIG_SECURITY_HARDENING=y, resolve new symbols, and compare the result with the original vendor configuration:

cp /path/to/vendor.config .config
make olddefconfig
scripts/config --file .config -e SECURITY -e SECURITY_HARDENING
make olddefconfig
scripts/diffconfig /path/to/vendor.config .config

Do not weaken KASLR, strong stack protection, strict kernel/module RWX, module signature enforcement, memory initialization, FORTIFY, hardened usercopy, AppArmor, BPF restrictions, or perf restrictions merely to obtain a build. Leave options ending in _TEST, _FIXTURE, or _BAD_FIXTURE disabled in a production configuration.

The optional RAP/private-stack profile requires GCC 16 and its complete compiler/binary verification workflow. These refreshed vendor patches received targeted GCC 16 builds of every enabled affected kernel object, including the native objtool and compiler plugin. They have not yet received fresh complete vendor builds or KVM boots. The previous vendor patch SHAs passed the recorded full builds, four-vCPU RAP/private-stack boots, and 1,118-case ordinary runtime suites; those results are predecessor evidence and are not promoted to these new artifacts. RAP/private stacks remain default-off in the ordinary profile.

Generic upstream 7.0.12 release identity

Item Value
Upstream version Linux 7.0.12
Upstream stable commit f53879e2e1e2fa053040e734c1ef8f386109a61b
Upstream archive SHA-256 57edc9a41efc1ca6b797afa8f4a587a30da2af6bca7356eb56e1e1a4ada265da
HDN source commit 9211be084b026255787ebdc7737601b9ea5ed0f6
Patch hdn-linux-7.0.12.patch
Patch SHA-256 00a887bbf034ddf31023f0305dff1b94cbc3403f6d9eb6f7985a86f765c8cf7a
Patch size 5,271,527 bytes; 160,062 lines

The source commit is public at:

https://github.com/Corvidae-Coding-Projects/hdn-kernel/commit/9211be084b026255787ebdc7737601b9ea5ed0f6

This checkpoint is newer than the separately qualified HDN release-30 kernel package and OS image. Their test results must not be treated as qualification of this newer patch. This exact source passed a clean GCC 16 build and complete compiler/binary inventory for 3,414 units, 65 reviewed exclusions, and 18 compiler probes. Two four-vCPU KVM campaigns then passed the signed RAP module interfaces, AIO, io_uring, epoll, userfaultfd, filesystem, nested-KVM, private-stack stress, CPU-hotplug, and 24/24 futex requeue-PI checks with clean poweroff. The broader analyzer, sanitizer, cross-architecture, fuzz, performance, physical-hardware, and final acceptance work remains pending.

The source-bound evidence is published with the development handoff at:

https://github.com/Corvidae-Coding-Projects/hdn-linux/tree/317d979f4ffd3451c25658f754c4365809c6e795/verification/evidence/rap-private-stack-7.0.12-9211be0

Obtain and verify Linux 7.0.12

Download the official archive:

curl -LO https://cdn.kernel.org/pub/linux/kernel/v7.x/linux-7.0.12.tar.xz

Verify both inputs before applying the patch:

printf '%s  %s\n' \
  57edc9a41efc1ca6b797afa8f4a587a30da2af6bca7356eb56e1e1a4ada265da \
  linux-7.0.12.tar.xz | sha256sum -c -

sha256sum -c /path/to/hdn-patch/SHA256SUMS

Do not apply this patch to another kernel version or to an already modified tree.

Apply the patch

Extract the verified upstream archive and enter its source directory:

tar -xf linux-7.0.12.tar.xz
cd linux-7.0.12

First perform a strict dry run, then apply it without allowing fuzzy hunks:

patch --dry-run --fuzz=0 -p1 \
  < /path/to/hdn-patch/hdn-linux-7.0.12.patch

patch --fuzz=0 -p1 \
  < /path/to/hdn-patch/hdn-linux-7.0.12.patch

The dry run and real application must complete without failed, offset, or fuzzy hunks.

For a Git-managed clean Linux 7.0.12 tree, this is an equivalent preflight:

git apply --check --whitespace=error \
  /path/to/hdn-patch/hdn-linux-7.0.12.patch
git apply /path/to/hdn-patch/hdn-linux-7.0.12.patch

Configure the kernel

The supported public target is x86_64. GCC is the currently exercised compiler for the generic configuration. Start with either your distribution's x86_64 kernel configuration or x86_64_defconfig; do not assume that an unrelated configuration is suitable for your hardware.

Example using the upstream x86_64 default:

build="$PWD/build"
mkdir -p "$build"

make O="$build" x86_64_defconfig
scripts/config --file "$build/.config" \
  -e SECURITY \
  -e SECURITY_HARDENING
make O="$build" olddefconfig

Example using the running distribution kernel as a starting point:

build="$PWD/build"
mkdir -p "$build"
cp "/boot/config-$(uname -r)" "$build/.config"

make O="$build" olddefconfig
scripts/config --file "$build/.config" \
  -e SECURITY \
  -e SECURITY_HARDENING
make O="$build" olddefconfig

Review the result interactively before building:

make O="$build" menuconfig

The master option is located under Security options → Hardening contract layer. Enabling CONFIG_SECURITY_HARDENING=y selects the default-on HDN policy and exploit-mitigation baseline. Confirm the final state with:

grep -E '^CONFIG_(SECURITY|SECURITY_HARDENING)(=|_)' "$build/.config"

Important configuration boundaries:

  • Options that remain default-off are not required for the ordinary HDN baseline. Several are qualification-stage mechanisms with additional compiler, architecture, or runtime prerequisites.
  • Leave every option ending in _TEST, _FIXTURE, or _BAD_FIXTURE disabled in production kernels. Some deliberately expose destructive probes intended only for disposable virtual machines.
  • CONFIG_SECURITY_HARDENING_RAP, RESPECTRE, private stacks, page-table ownership, KERNSEAL, and related advanced options must not be enabled merely to make the configuration look more complete. Read their Kconfig help and satisfy their compiler and verification requirements first. RAP requires its GCC 16 producer ABI and a source/config/compiler build identity.
  • When modules are enabled, the HDN master option forces module-signature enforcement. Arrange a trusted signing key and sign any required external or DKMS modules. The applied tree documents this in Documentation/admin-guide/module-signing.rst.
  • Secure Boot image signing and bootloader installation are distribution- and platform-specific; applying this source patch does not enroll a key or sign the resulting kernel image.

The patch contains the kernel enforcement surface only. A complete HDN system also needs compatible signed policy and userspace management components. Without them, profile-driven policy is not a complete deployed system even though build-time kernel defaults are present.

Build

Build out of tree:

make O="$build" -j"$(nproc)" bzImage modules

Kernel installation, initramfs generation, bootloader updates, module signing, and rollback entry creation are distribution-specific. Keep a known-good kernel and recovery path before installing a custom kernel.

Licensing

The Linux kernel is distributed under GPL-2.0 with the Linux syscall note, and individual files can carry additional compatible SPDX expressions. This patch does not replace those per-file terms. LICENSE contains the GNU General Public License version 2; after application, the kernel tree's COPYING and LICENSES/ directories remain the authoritative licensing record for the combined source.

Reporting problems

Please include the exact patch SHA-256, compiler version, architecture, final .config, build log, and whether the problem reproduces on unmodified Linux 7.0.12 when opening an issue:

https://github.com/Corvidae-Coding-Projects/hdn-patch/issues

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors