From dbba93c7dd4a14e4e54d8d2d24c582d47d974b92 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 28 Jul 2014 21:45:29 -0700 Subject: [PATCH] 3.14-stable patches added patches: s390-ptrace-fix-psw-mask-check.patch --- .../s390-ptrace-fix-psw-mask-check.patch | 56 +++++++++++++++++++ queue-3.14/series | 1 + 2 files changed, 57 insertions(+) create mode 100644 queue-3.14/s390-ptrace-fix-psw-mask-check.patch diff --git a/queue-3.14/s390-ptrace-fix-psw-mask-check.patch b/queue-3.14/s390-ptrace-fix-psw-mask-check.patch new file mode 100644 index 00000000000..0ca9be5b5b7 --- /dev/null +++ b/queue-3.14/s390-ptrace-fix-psw-mask-check.patch @@ -0,0 +1,56 @@ +From dab6cf55f81a6e16b8147aed9a843e1691dcd318 Mon Sep 17 00:00:00 2001 +From: Martin Schwidefsky +Date: Mon, 23 Jun 2014 15:29:40 +0200 +Subject: s390/ptrace: fix PSW mask check + +From: Martin Schwidefsky + +commit dab6cf55f81a6e16b8147aed9a843e1691dcd318 upstream. + +The PSW mask check of the PTRACE_POKEUSR_AREA command is incorrect. +The PSW_MASK_USER define contains the PSW_MASK_ASC bits, the ptrace +interface accepts all combinations for the address-space-control +bits. To protect the kernel space the PSW mask check in ptrace needs +to reject the address-space-control bit combination for home space. + +Fixes CVE-2014-3534 + +Signed-off-by: Martin Schwidefsky +Signed-off-by: Greg Kroah-Hartman + +--- + arch/s390/kernel/ptrace.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/arch/s390/kernel/ptrace.c ++++ b/arch/s390/kernel/ptrace.c +@@ -323,9 +323,14 @@ static int __poke_user(struct task_struc + unsigned long mask = PSW_MASK_USER; + + mask |= is_ri_task(child) ? PSW_MASK_RI : 0; +- if ((data & ~mask) != PSW_USER_BITS) ++ if ((data ^ PSW_USER_BITS) & ~mask) ++ /* Invalid psw mask. */ ++ return -EINVAL; ++ if ((data & PSW_MASK_ASC) == PSW_ASC_HOME) ++ /* Invalid address-space-control bits */ + return -EINVAL; + if ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)) ++ /* Invalid addressing mode bits */ + return -EINVAL; + } + *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; +@@ -661,9 +666,12 @@ static int __poke_user_compat(struct tas + + mask |= is_ri_task(child) ? PSW32_MASK_RI : 0; + /* Build a 64 bit psw mask from 31 bit mask. */ +- if ((tmp & ~mask) != PSW32_USER_BITS) ++ if ((tmp ^ PSW32_USER_BITS) & ~mask) + /* Invalid psw mask. */ + return -EINVAL; ++ if ((data & PSW32_MASK_ASC) == PSW32_ASC_HOME) ++ /* Invalid address-space-control bits */ ++ return -EINVAL; + regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | + (regs->psw.mask & PSW_MASK_BA) | + (__u64)(tmp & mask) << 32; diff --git a/queue-3.14/series b/queue-3.14/series index 32dd4fe824a..0df9f344b70 100644 --- a/queue-3.14/series +++ b/queue-3.14/series @@ -7,3 +7,4 @@ block-provide-compat-ioctl-for-blkzeroout.patch block-don-t-assume-last-put-of-shared-tags-is-for-the-host.patch libata-support-the-ata-host-which-implements-a-queue-depth-less-than-32.patch libata-introduce-ata_host-n_tags-to-avoid-oops-on-sas-controllers.patch +s390-ptrace-fix-psw-mask-check.patch -- 2.47.3