diff --git a/SOURCES/1100-smb-client-reject-userspace-cifs.spnego-descriptions.patch b/SOURCES/1100-smb-client-reject-userspace-cifs.spnego-descriptions.patch new file mode 100644 index 000000000..52ea78644 --- /dev/null +++ b/SOURCES/1100-smb-client-reject-userspace-cifs.spnego-descriptions.patch @@ -0,0 +1,66 @@ +From 3da1fdf4efbc490041eb4f836bf596201203f8f2 Mon Sep 17 00:00:00 2001 +From: Asim Viladi Oglu Manizada +Date: Sat, 16 May 2026 21:15:39 +0000 +Subject: smb: client: reject userspace cifs.spnego descriptions + +cifs.spnego key descriptions contain authority-bearing fields such as +pid, uid, creduid, and upcall_target that cifs.upcall treats as +kernel-originating inputs. However, userspace can also create keys of +this type through request_key(2) or add_key(2), allowing those fields to +be supplied without CIFS origin. + +Only accept cifs.spnego descriptions while CIFS is using its private +spnego_cred to request the key. + +Fixes: f1d662a7d5e5 ("[CIFS] Add upcall files for cifs to use spnego/kerberos") +Assisted-by: avom-custom-harness:gpt-5.5-qwen3.6-mod-mix +Reviewed-by: David Howells +Signed-off-by: Asim Viladi Oglu Manizada +Signed-off-by: Steve French +--- + fs/cifs/cifs_spnego.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c +index 3a41bbada04c76..44c40727568042 100644 +--- a/fs/cifs/cifs_spnego.c ++++ b/fs/cifs/cifs_spnego.c +@@ -8,6 +8,7 @@ + */ + + #include ++#include + #include + #include + #include +@@ -40,12 +41,27 @@ cifs_spnego_key_destroy(struct key *key) + kfree(key->payload.data[0]); + } + ++static int ++cifs_spnego_key_vet_description(const char *description) ++{ ++ /* ++ * cifs.spnego descriptions are authority-bearing inputs to cifs.upcall. ++ * They are only valid when produced by CIFS while using the private ++ * spnego_cred installed below. Do not let userspace create this type ++ * of key through request_key(2)/add_key(2), since the helper treats ++ * pid/uid/creduid/upcall_target as kernel-originating fields. ++ */ ++ if (current_cred() != spnego_cred) ++ return -EPERM; ++ return 0; ++} + + /* + * keytype for CIFS spnego keys + */ + struct key_type cifs_spnego_key_type = { + .name = "cifs.spnego", ++ .vet_description = cifs_spnego_key_vet_description, + .instantiate = cifs_spnego_key_instantiate, + .destroy = cifs_spnego_key_destroy, + .describe = user_describe, +-- +cgit 1.3-korg + diff --git a/SPECS/kernel.spec b/SPECS/kernel.spec index 7b2d96699..9f2ec0578 100644 --- a/SPECS/kernel.spec +++ b/SPECS/kernel.spec @@ -38,10 +38,11 @@ # define buildid .local %define specversion 4.18.0 -%define pkgrelease 553.126.1.el8_10 +%define pkgrelease 553.126.2.el8_10 +%define tarfile_release 553.126.1.el8_10 # allow pkg_release to have configurable %%{?dist} tag -%define specrelease 553.126.1%{?dist} +%define specrelease 553.126.2%{?dist} %define pkg_release %{specrelease}%{?buildid} @@ -435,7 +436,7 @@ BuildRequires: xmlto BuildRequires: asciidoc %endif -Source0: linux-%{specversion}-%{pkgrelease}.tar.xz +Source0: linux-%{specversion}-%{tarfile_release}.tar.xz Source9: x509.genkey @@ -530,6 +531,8 @@ Patch999999: linux-kernel-test.patch # AlmaLinux Patch Patch1000: debrand-single-cpu.patch Patch1002: debrand-rh-i686-cpu.patch +Patch1100: 1100-smb-client-reject-userspace-cifs.spnego-descriptions.patch + Patch2001: 0001-Enable-all-disabled-pci-devices-by-moving-to-unmaint.patch Patch2002: 0002-Bring-back-deprecated-pci-ids-to-megaraid_sas-driver.patch Patch2003: 0003-Bring-back-deprecated-pci-ids-to-mptsas-mptspi-drive.patch @@ -1096,9 +1099,9 @@ ApplyOptionalPatch() fi } -%setup -q -n %{name}-%{specversion}-%{pkgrelease} -c -cp -v %{SOURCE9000} linux-%{specversion}-%{pkgrelease}/certs/rhel.pem -mv linux-%{specversion}-%{pkgrelease} linux-%{KVERREL} +%setup -q -n %{name}-%{specversion}-%{tarfile_release} -c +cp -v %{SOURCE9000} linux-%{specversion}-%{tarfile_release}/certs/rhel.pem +mv linux-%{specversion}-%{tarfile_release} linux-%{KVERREL} cd linux-%{KVERREL} @@ -1107,6 +1110,7 @@ ApplyOptionalPatch linux-kernel-test.patch # Applying AlmaLinux Patch ApplyPatch debrand-single-cpu.patch ApplyPatch debrand-rh-i686-cpu.patch +ApplyPatch 1100-smb-client-reject-userspace-cifs.spnego-descriptions.patch ApplyPatch 0001-Enable-all-disabled-pci-devices-by-moving-to-unmaint.patch ApplyPatch 0002-Bring-back-deprecated-pci-ids-to-megaraid_sas-driver.patch ApplyPatch 0003-Bring-back-deprecated-pci-ids-to-mptsas-mptspi-drive.patch @@ -2713,6 +2717,10 @@ fi # # %changelog +* Thu May 28 2026 Andrew Lukoshko - 4.18.0-553.126.2 +- smb: client: reject userspace cifs.spnego descriptions (upstream commit + 3da1fdf4efbc) + * Thu May 28 2026 Andrei Lukoshko - 4.18.0-553.126.1 - hpsa: bring back deprecated PCI ids #CFHack #CFHack2024 - mptsas: bring back deprecated PCI ids #CFHack #CFHack2024