diff options
| author | Ankur Tyagi <ankur.tyagi85@gmail.com> | 2026-01-09 22:28:31 +1300 |
|---|---|---|
| committer | Anuj Mittal <anuj.mittal@oss.qualcomm.com> | 2026-01-12 07:51:56 +0530 |
| commit | 2aa20b71417e0618825e250ac7c171777bed1824 (patch) | |
| tree | 0127d0a4b6acb327f8020628c97cc36a80113045 /meta-networking | |
| parent | 626bcb7f86300028d7f2b8a7cef4ad247dcc2b93 (diff) | |
| download | meta-openembedded-2aa20b71417e0618825e250ac7c171777bed1824.tar.gz | |
cifs-utils: patch CVE-2025-2312
Details: https://nvd.nist.gov/vuln/detail/CVE-2025-2312
Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com>
Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
Diffstat (limited to 'meta-networking')
| -rw-r--r-- | meta-networking/recipes-support/cifs/cifs-utils/CVE-2025-2312.patch | 136 | ||||
| -rw-r--r-- | meta-networking/recipes-support/cifs/cifs-utils_7.0.bb | 4 |
2 files changed, 139 insertions, 1 deletions
diff --git a/meta-networking/recipes-support/cifs/cifs-utils/CVE-2025-2312.patch b/meta-networking/recipes-support/cifs/cifs-utils/CVE-2025-2312.patch new file mode 100644 index 0000000000..3e62b0f1c3 --- /dev/null +++ b/meta-networking/recipes-support/cifs/cifs-utils/CVE-2025-2312.patch | |||
| @@ -0,0 +1,136 @@ | |||
| 1 | From faf6ce0abd6fbca95721eb88754add9c0c700a5c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ritvik Budhiraja <rbudhiraja@microsoft.com> | ||
| 3 | Date: Tue, 19 Nov 2024 06:07:58 +0000 | ||
| 4 | Subject: [PATCH] CIFS.upcall to accomodate new namespace mount opt | ||
| 5 | |||
| 6 | NOTE: This patch is dependent on one of the previously sent patches: | ||
| 7 | [PATCH] CIFS: New mount option for cifs.upcall namespace resolution | ||
| 8 | which introduces a new mount option called upcall_target, to | ||
| 9 | customise the upcall behaviour. | ||
| 10 | |||
| 11 | Building upon the above patch, the following patch adds functionality | ||
| 12 | to handle upcall_target as a mount option in cifs.upcall. It can have 2 values - | ||
| 13 | mount, app. | ||
| 14 | Having this new mount option allows the mount command to specify where the | ||
| 15 | upcall should happen: 'mount' for resolving the upcall to the host | ||
| 16 | namespace, and 'app' for resolving the upcall to the ns of the calling | ||
| 17 | thread. This will enable both the scenarios where the Kerberos credentials | ||
| 18 | can be found on the application namespace or the host namespace to which | ||
| 19 | just the mount operation is "delegated". | ||
| 20 | This aids use cases like Kubernetes where the mount | ||
| 21 | happens on behalf of the application in another container altogether. | ||
| 22 | |||
| 23 | Signed-off-by: Ritvik Budhiraja <rbudhiraja@microsoft.com> | ||
| 24 | Signed-off-by: Steve French <stfrench@microsoft.com> | ||
| 25 | |||
| 26 | CVE: CVE-2025-2312 | ||
| 27 | Upstream-Status: Backport [https://git.samba.org/?p=cifs-utils.git;a=commit;h=89b679228cc1be9739d54203d28289b03352c174] | ||
| 28 | (cherry picked from commit 89b679228cc1be9739d54203d28289b03352c174) | ||
| 29 | Signed-off-by: Ankur Tyagi <ankur.tyagi85@gmail.com> | ||
| 30 | --- | ||
| 31 | cifs.upcall.c | 55 +++++++++++++++++++++++++++++++++++++++++++-------- | ||
| 32 | 1 file changed, 47 insertions(+), 8 deletions(-) | ||
| 33 | |||
| 34 | diff --git a/cifs.upcall.c b/cifs.upcall.c | ||
| 35 | index 52c0328..0883afa 100644 | ||
| 36 | --- a/cifs.upcall.c | ||
| 37 | +++ b/cifs.upcall.c | ||
| 38 | @@ -953,6 +953,13 @@ struct decoded_args { | ||
| 39 | #define MAX_USERNAME_SIZE 256 | ||
| 40 | char username[MAX_USERNAME_SIZE + 1]; | ||
| 41 | |||
| 42 | +#define MAX_UPCALL_STRING_LEN 6 /* "mount\0" */ | ||
| 43 | + enum upcall_target_enum { | ||
| 44 | + UPTARGET_UNSPECIFIED, /* not specified, defaults to app */ | ||
| 45 | + UPTARGET_MOUNT, /* upcall to the mount namespace */ | ||
| 46 | + UPTARGET_APP, /* upcall to the application namespace which did the mount */ | ||
| 47 | + } upcall_target; | ||
| 48 | + | ||
| 49 | uid_t uid; | ||
| 50 | uid_t creduid; | ||
| 51 | pid_t pid; | ||
| 52 | @@ -969,6 +976,7 @@ struct decoded_args { | ||
| 53 | #define DKD_HAVE_PID 0x20 | ||
| 54 | #define DKD_HAVE_CREDUID 0x40 | ||
| 55 | #define DKD_HAVE_USERNAME 0x80 | ||
| 56 | +#define DKD_HAVE_UPCALL_TARGET 0x100 | ||
| 57 | #define DKD_MUSTHAVE_SET (DKD_HAVE_HOSTNAME|DKD_HAVE_VERSION|DKD_HAVE_SEC) | ||
| 58 | int have; | ||
| 59 | }; | ||
| 60 | @@ -979,6 +987,7 @@ __decode_key_description(const char *desc, struct decoded_args *arg) | ||
| 61 | size_t len; | ||
| 62 | char *pos; | ||
| 63 | const char *tkn = desc; | ||
| 64 | + arg->upcall_target = UPTARGET_UNSPECIFIED; | ||
| 65 | |||
| 66 | do { | ||
| 67 | pos = index(tkn, ';'); | ||
| 68 | @@ -1077,6 +1086,31 @@ __decode_key_description(const char *desc, struct decoded_args *arg) | ||
| 69 | } | ||
| 70 | arg->have |= DKD_HAVE_VERSION; | ||
| 71 | syslog(LOG_DEBUG, "ver=%d", arg->ver); | ||
| 72 | + } else if (strncmp(tkn, "upcall_target=", 14) == 0) { | ||
| 73 | + if (pos == NULL) | ||
| 74 | + len = strlen(tkn); | ||
| 75 | + else | ||
| 76 | + len = pos - tkn; | ||
| 77 | + | ||
| 78 | + len -= 14; | ||
| 79 | + if (len > MAX_UPCALL_STRING_LEN) { | ||
| 80 | + syslog(LOG_ERR, "upcall_target= value too long for buffer"); | ||
| 81 | + return 1; | ||
| 82 | + } | ||
| 83 | + if (strncmp(tkn + 14, "mount", 5) == 0) { | ||
| 84 | + arg->upcall_target = UPTARGET_MOUNT; | ||
| 85 | + syslog(LOG_DEBUG, "upcall_target=mount"); | ||
| 86 | + } else if (strncmp(tkn + 14, "app", 3) == 0) { | ||
| 87 | + arg->upcall_target = UPTARGET_APP; | ||
| 88 | + syslog(LOG_DEBUG, "upcall_target=app"); | ||
| 89 | + } else { | ||
| 90 | + // Should never happen | ||
| 91 | + syslog(LOG_ERR, "Invalid upcall_target value: %s, defaulting to app", | ||
| 92 | + tkn + 14); | ||
| 93 | + arg->upcall_target = UPTARGET_APP; | ||
| 94 | + syslog(LOG_DEBUG, "upcall_target=app"); | ||
| 95 | + } | ||
| 96 | + arg->have |= DKD_HAVE_UPCALL_TARGET; | ||
| 97 | } | ||
| 98 | if (pos == NULL) | ||
| 99 | break; | ||
| 100 | @@ -1440,15 +1474,20 @@ int main(const int argc, char *const argv[]) | ||
| 101 | * acceptably in containers, because we'll be looking at the correct | ||
| 102 | * filesystem and have the correct network configuration. | ||
| 103 | */ | ||
| 104 | - rc = switch_to_process_ns(arg->pid); | ||
| 105 | - if (rc == -1) { | ||
| 106 | - syslog(LOG_ERR, "unable to switch to process namespace: %s", strerror(errno)); | ||
| 107 | - rc = 1; | ||
| 108 | - goto out; | ||
| 109 | + if (arg->upcall_target == UPTARGET_APP || arg->upcall_target == UPTARGET_UNSPECIFIED) { | ||
| 110 | + syslog(LOG_INFO, "upcall_target=app, switching namespaces to application thread"); | ||
| 111 | + rc = switch_to_process_ns(arg->pid); | ||
| 112 | + if (rc == -1) { | ||
| 113 | + syslog(LOG_ERR, "unable to switch to process namespace: %s", strerror(errno)); | ||
| 114 | + rc = 1; | ||
| 115 | + goto out; | ||
| 116 | + } | ||
| 117 | + if (trim_capabilities(env_probe)) | ||
| 118 | + goto out; | ||
| 119 | + } else { | ||
| 120 | + syslog(LOG_INFO, "upcall_target=mount, not switching namespaces to application thread"); | ||
| 121 | } | ||
| 122 | |||
| 123 | - if (trim_capabilities(env_probe)) | ||
| 124 | - goto out; | ||
| 125 | |||
| 126 | /* | ||
| 127 | * The kernel doesn't pass down the gid, so we resort here to scraping | ||
| 128 | @@ -1495,7 +1534,7 @@ int main(const int argc, char *const argv[]) | ||
| 129 | * look at the environ file. | ||
| 130 | */ | ||
| 131 | env_cachename = | ||
| 132 | - get_cachename_from_process_env(env_probe ? arg->pid : 0); | ||
| 133 | + get_cachename_from_process_env((env_probe && (arg->upcall_target == UPTARGET_APP)) ? arg->pid : 0); | ||
| 134 | |||
| 135 | rc = setuid(uid); | ||
| 136 | if (rc == -1) { | ||
diff --git a/meta-networking/recipes-support/cifs/cifs-utils_7.0.bb b/meta-networking/recipes-support/cifs/cifs-utils_7.0.bb index c78bbae7b8..4e27491bba 100644 --- a/meta-networking/recipes-support/cifs/cifs-utils_7.0.bb +++ b/meta-networking/recipes-support/cifs/cifs-utils_7.0.bb | |||
| @@ -5,7 +5,9 @@ LICENSE = "GPL-3.0-only & LGPL-3.0-only" | |||
| 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" | 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" |
| 6 | 6 | ||
| 7 | SRCREV = "316522036133d44ed02cd39ed2748e2b59c85b30" | 7 | SRCREV = "316522036133d44ed02cd39ed2748e2b59c85b30" |
| 8 | SRC_URI = "git://git.samba.org/cifs-utils.git;branch=master" | 8 | SRC_URI = "git://git.samba.org/cifs-utils.git;branch=master \ |
| 9 | file://CVE-2025-2312.patch \ | ||
| 10 | " | ||
| 9 | 11 | ||
| 10 | S = "${WORKDIR}/git" | 12 | S = "${WORKDIR}/git" |
| 11 | DEPENDS += "libtalloc" | 13 | DEPENDS += "libtalloc" |
