futex: CVE-2014-3153
PATCH 1/3 futex: CVE-2014-3153
Prevent requeue pi on same futex
References
http://www.openwall.com/lists/oss-security/2014/06/05/22
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/
commit/?id=b9103e5f3a197aec4ec3d78fd5ff2bb74a496b42
--- .../linux/files/futex-CVE-2014-3153.patch | 89 ++++++++++++++++++++++ recipes-kernel/linux/linux-qoriq_3.12.bb | 1 + 2 files changed, 90 insertions(+) create mode 100644 recipes-kernel/linux/files/futex-CVE-2014-3153.patch
recipes-kernel/linux/files/futex-CVE-2014-3153.patch new file +89 -0
@@ -0,0 +1,89 @@ +From b9103e5f3a197aec4ec3d78fd5ff2bb74a496b42 Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner <[email protected]> +Date: Tue, 3 Jun 2014 12:27:06 +0000 +Subject: [PATCH] futex-prevent-requeue-pi-on-same-futex.patch futex: Forbid + uaddr == uaddr2 in futex_requeue(..., requeue_pi=1) + +commit e9c243a5a6de0be8e584c604d353412584b592f8 upstream. + +If uaddr == uaddr2, then we have broken the rule of only requeueing from +a non-pi futex to a pi futex with this call. If we attempt this, then +dangling pointers may be left for rt_waiter resulting in an exploitable +condition. + +This change brings futex_requeue() in line with futex_wait_requeue_pi() +which performs the same check as per commit 6f7b0a2a5c0f ("futex: Forbid +uaddr == uaddr2 in futex_wait_requeue_pi()") + +[ tglx: Compare the resulting keys as well, as uaddrs might be + different depending on the mapping ] + +Fixes CVE-2014-3153. + +Upstream-Status: Backport + +Reported-by: Pinkie Pie +Signed-off-by: Will Drewry <[email protected]> +Signed-off-by: Kees Cook <[email protected]> +Signed-off-by: Thomas Gleixner <[email protected]> +Reviewed-by: Darren Hart <[email protected]> +Signed-off-by: Linus Torvalds <[email protected]> +Signed-off-by: Jiri Slaby <[email protected]> +Signed-off-by: Sona Sarmadi <[email protected]> +--- + kernel/futex.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/kernel/futex.c b/kernel/futex.c +index 6c7975b..ab207d6 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -1295,6 +1295,13 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, + + if (requeue_pi) { + /* ++ * Requeue PI only works on two distinct uaddrs. This ++ * check is only valid for private futexes. See below. ++ */ ++ if (uaddr1 == uaddr2) ++ return -EINVAL; ++ ++ /* + * requeue_pi requires a pi_state, try to allocate it now + * without any locks in case it fails. + */ +@@ -1332,6 +1339,15 @@ retry: + if (unlikely(ret != 0)) + goto out_put_key1; + ++ /* ++ * The check above which compares uaddrs is not sufficient for ++ * shared futexes. We need to compare the keys: ++ */ ++ if (requeue_pi && match_futex(&key1, &key2)) { ++ ret = -EINVAL; ++ goto out_put_keys; ++ } ++ + hb1 = hash_futex(&key1); + hb2 = hash_futex(&key2); + +@@ -2362,6 +2378,15 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + if (ret) + goto out_key2; + ++ /* ++ * The check above which compares uaddrs is not sufficient for ++ * shared futexes. We need to compare the keys: ++ */ ++ if (match_futex(&q.key, &key2)) { ++ ret = -EINVAL; ++ goto out_put_keys; ++ } ++ + /* Queue the futex_q, drop the hb lock, wait for wakeup. */ + futex_wait_queue_me(hb, &q, to); + +-- +1.9.1 +
recipes-kernel/linux/linux-qoriq_3.12.bb +1 -0
@@ -29,6 +29,7 @@ SRC_URI = "git://git.freescale.com/ppc/sdk/linux.git;nobranch=1 \ file://sctp-CVE-2014-7841.patch \ file://0001-ALSA-CVE-2014-4656.patch \ file://0002-ALSA-CVE-2014-4656.patch \ + file://futex-CVE-2014-3153.patch \ " SRCREV = "6619b8b55796cdf0cec04b66a71288edd3057229"
Signature · 1 line
1.9.1
PATCH 2/3 target: CVE-2014-4027
Explicitly clear ramdisk_mcp backend pages
References
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-4027
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/
commit/?id=186f32e2096c7d9cd9106b8dedd79c596f4c8398
--- .../linux/files/target-CVE-2014-4027.patch | 46 ++++++++++++++++++++++ recipes-kernel/linux/linux-qoriq_3.12.bb | 1 + 2 files changed, 47 insertions(+) create mode 100644 recipes-kernel/linux/files/target-CVE-2014-4027.patch
recipes-kernel/linux/files/target-CVE-2014-4027.patch new file +46 -0
@@ -0,0 +1,46 @@ +From 186f32e2096c7d9cd9106b8dedd79c596f4c8398 Mon Sep 17 00:00:00 2001 +From: "Nicholas A. Bellinger" <[email protected]> +Date: Mon, 16 Jun 2014 20:59:52 +0000 +Subject: [PATCH] target: Explicitly clear ramdisk_mcp backend pages + +[Note that a different patch to address the same issue went in during +v3.15-rc1 (commit 4442dc8a), but includes a bunch of other changes that +don't strictly apply to fixing the bug] + +This patch changes rd_allocate_sgl_table() to explicitly clear +ramdisk_mcp backend memory pages by passing __GFP_ZERO into +alloc_pages(). + +This addresses a potential security issue where reading from a +ramdisk_mcp could return sensitive information, and follows what +>= v3.15 does to explicitly clear ramdisk_mcp memory at backend +device initialization time. + +This fixes CVE-2014-4027 +Upstream-Status: Backport + +Reported-by: Jorge Daniel Sequeira Matias <[email protected]> +Cc: Jorge Daniel Sequeira Matias <[email protected]> +Signed-off-by: Nicholas Bellinger <[email protected]> +Signed-off-by: Jiri Slaby <[email protected]> +Signed-off-by: Sona Sarmadi <[email protected]> +--- + drivers/target/target_core_rd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c +index 131327a..9f6bede 100644 +--- a/drivers/target/target_core_rd.c ++++ b/drivers/target/target_core_rd.c +@@ -179,7 +179,7 @@ static int rd_build_device_space(struct rd_dev *rd_dev) + - 1; + + for (j = 0; j < sg_per_table; j++) { +- pg = alloc_pages(GFP_KERNEL, 0); ++ pg = alloc_pages(GFP_KERNEL | __GFP_ZERO, 0); + if (!pg) { + pr_err("Unable to allocate scatterlist" + " pages for struct rd_dev_sg_table\n"); +-- +1.9.1 +
recipes-kernel/linux/linux-qoriq_3.12.bb +1 -0
@@ -30,6 +30,7 @@ SRC_URI = "git://git.freescale.com/ppc/sdk/linux.git;nobranch=1 \ file://0001-ALSA-CVE-2014-4656.patch \ file://0002-ALSA-CVE-2014-4656.patch \ file://futex-CVE-2014-3153.patch \ + file://target-CVE-2014-4027.patch \ " SRCREV = "6619b8b55796cdf0cec04b66a71288edd3057229"
Signature · 1 line
1.9.1
PATCH 3/3 fs-isofs: CVE-2014-9420
In reply to Sona SarmadiFixes infinite loop in CE record entries
References
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-9420
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/
commit/?id=1fe5620fcd6c2f0a4a927ee10c8e53196da392f3
--- .../linux/files/fs-isofs-CVE-2014-9420.patch | 58 ++++++++++++++++++++++ recipes-kernel/linux/linux-qoriq_3.12.bb | 1 + 2 files changed, 59 insertions(+) create mode 100644 recipes-kernel/linux/files/fs-isofs-CVE-2014-9420.patch
recipes-kernel/linux/files/fs-isofs-CVE-2014-9420.patch new file +58 -0
@@ -0,0 +1,58 @@ +From 1fe5620fcd6c2f0a4a927ee10c8e53196da392f3 Mon Sep 17 00:00:00 2001 +From: Jan Kara <[email protected]> +Date: Mon, 15 Dec 2014 14:22:46 +0100 +Subject: [PATCH] isofs: Fix infinite looping over CE entries + +commit f54e18f1b831c92f6512d2eedb224cd63d607d3d upstream. + +Rock Ridge extensions define so called Continuation Entries (CE) which +define where is further space with Rock Ridge data. Corrupted isofs +image can contain arbitrarily long chain of these, including a one +containing loop and thus causing kernel to end in an infinite loop when +traversing these entries. + +Limit the traversal to 32 entries which should be more than enough space +to store all the Rock Ridge data. + +Reported-by: P J P <[email protected]> +Signed-off-by: Jan Kara <[email protected]> +Signed-off-by: Greg Kroah-Hartman <[email protected]> +Signed-off-by: Sona Sarmadi <[email protected]> +--- + fs/isofs/rock.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c +index f488bba..bb63254 100644 +--- a/fs/isofs/rock.c ++++ b/fs/isofs/rock.c +@@ -30,6 +30,7 @@ struct rock_state { + int cont_size; + int cont_extent; + int cont_offset; ++ int cont_loops; + struct inode *inode; + }; + +@@ -73,6 +74,9 @@ static void init_rock_state(struct rock_state *rs, struct inode *inode) + rs->inode = inode; + } + ++/* Maximum number of Rock Ridge continuation entries */ ++#define RR_MAX_CE_ENTRIES 32 ++ + /* + * Returns 0 if the caller should continue scanning, 1 if the scan must end + * and -ve on error. +@@ -105,6 +109,8 @@ static int rock_continue(struct rock_state *rs) + goto out; + } + ret = -EIO; ++ if (++rs->cont_loops >= RR_MAX_CE_ENTRIES) ++ goto out; + bh = sb_bread(rs->inode->i_sb, rs->cont_extent); + if (bh) { + memcpy(rs->buffer, bh->b_data + rs->cont_offset, +-- +1.9.1 +
recipes-kernel/linux/linux-qoriq_3.12.bb +1 -0
@@ -31,6 +31,7 @@ SRC_URI = "git://git.freescale.com/ppc/sdk/linux.git;nobranch=1 \ file://0002-ALSA-CVE-2014-4656.patch \ file://futex-CVE-2014-3153.patch \ file://target-CVE-2014-4027.patch \ + file://fs-isofs-CVE-2014-9420.patch \ " SRCREV = "6619b8b55796cdf0cec04b66a71288edd3057229"
Signature · 1 line
1.9.1