Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1612847 > unrolled thread

[PATCH 4.4 00/14] 4.4.59-stable review

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-03-30 12:10 +0200
Last post2017-03-31 05:50 +0200
Articles 8 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 4.4 00/14] 4.4.59-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
    [PATCH 4.4 08/14] mips/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
    [PATCH 4.4 09/14] sparc/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
    [PATCH 4.4 02/14] xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
    [PATCH 4.4 06/14] c6x/ptrace: Remove useless PTRACE_SETREGSET implementation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
    [PATCH 4.4 03/14] xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-30 12:10 +0200
    Re: [PATCH 4.4 00/14] 4.4.59-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-03-30 21:00 +0200
    Re: [PATCH 4.4 00/14] 4.4.59-stable review Guenter Roeck <linux@roeck-us.net> - 2017-03-31 05:50 +0200

#1612847 — [PATCH 4.4 00/14] 4.4.59-stable review

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-03-30 12:10 +0200
Subject[PATCH 4.4 00/14] 4.4.59-stable review
Message-ID<tqFbH-4Hn-7@gated-at.bofh.it>
This is the start of the stable review cycle for the 4.4.59 release.
There are 14 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Sat Apr  1 09:49:26 UTC 2017.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.59-rc1.gz
or in the git tree and branch at:
  git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 4.4.59-rc1

Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    sched/rt: Add a missing rescheduling point

Eric Biggers <ebiggers@google.com>
    fscrypt: remove broken support for detecting keyring key revocation

Dave Martin <Dave.Martin@arm.com>
    metag/ptrace: Reject partial NT_METAG_RPIPE writes

Dave Martin <Dave.Martin@arm.com>
    metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS

Dave Martin <Dave.Martin@arm.com>
    metag/ptrace: Preserve previous registers for short regset write

Dave Martin <Dave.Martin@arm.com>
    sparc/ptrace: Preserve previous registers for short regset write

Dave Martin <Dave.Martin@arm.com>
    mips/ptrace: Preserve previous registers for short regset write

Dave Martin <Dave.Martin@arm.com>
    h8300/ptrace: Fix incorrect register transfer count

Dave Martin <Dave.Martin@arm.com>
    c6x/ptrace: Remove useless PTRACE_SETREGSET implementation

Bjorn Andersson <bjorn.andersson@linaro.org>
    pinctrl: qcom: Don't clear status bit on irq_unmask

Ladi Prosek <lprosek@redhat.com>
    virtio_balloon: init 1st buffer in stats vq

Andy Whitcroft <apw@canonical.com>
    xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder

Andy Whitcroft <apw@canonical.com>
    xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window

Florian Westphal <fw@strlen.de>
    xfrm: policy: init locks early


-------------

Diffstat:

 Makefile                           |  4 ++--
 arch/c6x/kernel/ptrace.c           | 41 --------------------------------------
 arch/h8300/kernel/ptrace.c         |  8 +++++---
 arch/metag/kernel/ptrace.c         | 19 ++++++++++++++----
 arch/mips/kernel/ptrace.c          |  3 ++-
 arch/sparc/kernel/ptrace_64.c      |  2 +-
 drivers/pinctrl/qcom/pinctrl-msm.c |  4 ----
 drivers/virtio/virtio_balloon.c    |  2 ++
 fs/ext4/crypto_key.c               | 28 +++++++-------------------
 fs/ext4/ext4.h                     | 14 +------------
 fs/ext4/ext4_crypto.h              |  1 -
 fs/f2fs/crypto_key.c               | 28 +++++++-------------------
 fs/f2fs/f2fs.h                     | 14 +------------
 fs/f2fs/f2fs_crypto.h              |  1 -
 kernel/sched/deadline.c            |  3 +--
 kernel/sched/rt.c                  |  3 +--
 net/xfrm/xfrm_policy.c             | 10 +++++-----
 net/xfrm/xfrm_user.c               |  9 ++++++++-
 18 files changed, 58 insertions(+), 136 deletions(-)

[toc] | [next] | [standalone]


#1612848 — [PATCH 4.4 08/14] mips/ptrace: Preserve previous registers for short regset write

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-03-30 12:10 +0200
Subject[PATCH 4.4 08/14] mips/ptrace: Preserve previous registers for short regset write
Message-ID<tqFbJ-4Hn-67@gated-at.bofh.it>
In reply to#1612847
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dave Martin <Dave.Martin@arm.com>

commit d614fd58a2834cfe4efa472c33c8f3ce2338b09b upstream.

Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET
to fill all the registers, the thread's old registers are preserved.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/kernel/ptrace.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -485,7 +485,8 @@ static int fpr_set(struct task_struct *t
 					  &target->thread.fpu,
 					  0, sizeof(elf_fpregset_t));
 
-	for (i = 0; i < NUM_FPU_REGS; i++) {
+	BUILD_BUG_ON(sizeof(fpr_val) != sizeof(elf_fpreg_t));
+	for (i = 0; i < NUM_FPU_REGS && count >= sizeof(elf_fpreg_t); i++) {
 		err = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 					 &fpr_val, i * sizeof(elf_fpreg_t),
 					 (i + 1) * sizeof(elf_fpreg_t));

[toc] | [prev] | [next] | [standalone]


#1612851 — [PATCH 4.4 09/14] sparc/ptrace: Preserve previous registers for short regset write

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-03-30 12:10 +0200
Subject[PATCH 4.4 09/14] sparc/ptrace: Preserve previous registers for short regset write
Message-ID<tqFbJ-4Hn-57@gated-at.bofh.it>
In reply to#1612847
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dave Martin <Dave.Martin@arm.com>

commit d3805c546b275c8cc7d40f759d029ae92c7175f2 upstream.

Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET
to fill all the registers, the thread's old registers are preserved.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/sparc/kernel/ptrace_64.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -311,7 +311,7 @@ static int genregs64_set(struct task_str
 	}
 
 	if (!ret) {
-		unsigned long y;
+		unsigned long y = regs->y;
 
 		ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 					 &y,

[toc] | [prev] | [next] | [standalone]


#1612852 — [PATCH 4.4 02/14] xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-03-30 12:10 +0200
Subject[PATCH 4.4 02/14] xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window
Message-ID<tqFbJ-4Hn-55@gated-at.bofh.it>
In reply to#1612847
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andy Whitcroft <apw@canonical.com>

commit 677e806da4d916052585301785d847c3b3e6186a upstream.

When a new xfrm state is created during an XFRM_MSG_NEWSA call we
validate the user supplied replay_esn to ensure that the size is valid
and to ensure that the replay_window size is within the allocated
buffer.  However later it is possible to update this replay_esn via a
XFRM_MSG_NEWAE call.  There we again validate the size of the supplied
buffer matches the existing state and if so inject the contents.  We do
not at this point check that the replay_window is within the allocated
memory.  This leads to out-of-bounds reads and writes triggered by
netlink packets.  This leads to memory corruption and the potential for
priviledge escalation.

We already attempt to validate the incoming replay information in
xfrm_new_ae() via xfrm_replay_verify_len().  This confirms that the user
is not trying to change the size of the replay state buffer which
includes the replay_esn.  It however does not check the replay_window
remains within that buffer.  Add validation of the contained
replay_window.

CVE-2017-7184
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/xfrm/xfrm_user.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -415,6 +415,9 @@ static inline int xfrm_replay_verify_len
 	if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen)
 		return -EINVAL;
 
+	if (up->replay_window > up->bmp_len * sizeof(__u32) * 8)
+		return -EINVAL;
+
 	return 0;
 }
 

[toc] | [prev] | [next] | [standalone]


#1612853 — [PATCH 4.4 06/14] c6x/ptrace: Remove useless PTRACE_SETREGSET implementation

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-03-30 12:10 +0200
Subject[PATCH 4.4 06/14] c6x/ptrace: Remove useless PTRACE_SETREGSET implementation
Message-ID<tqFbJ-4Hn-71@gated-at.bofh.it>
In reply to#1612847
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dave Martin <Dave.Martin@arm.com>

commit fb411b837b587a32046dc4f369acb93a10b1def8 upstream.

gpr_set won't work correctly and can never have been tested, and the
correct behaviour is not clear due to the endianness-dependent task
layout.

So, just remove it.  The core code will now return -EOPNOTSUPPORT when
trying to set NT_PRSTATUS on this architecture until/unless a correct
implementation is supplied.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/c6x/kernel/ptrace.c |   41 -----------------------------------------
 1 file changed, 41 deletions(-)

--- a/arch/c6x/kernel/ptrace.c
+++ b/arch/c6x/kernel/ptrace.c
@@ -69,46 +69,6 @@ static int gpr_get(struct task_struct *t
 				   0, sizeof(*regs));
 }
 
-static int gpr_set(struct task_struct *target,
-		   const struct user_regset *regset,
-		   unsigned int pos, unsigned int count,
-		   const void *kbuf, const void __user *ubuf)
-{
-	int ret;
-	struct pt_regs *regs = task_pt_regs(target);
-
-	/* Don't copyin TSR or CSR */
-	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
-				 &regs,
-				 0, PT_TSR * sizeof(long));
-	if (ret)
-		return ret;
-
-	ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-					PT_TSR * sizeof(long),
-					(PT_TSR + 1) * sizeof(long));
-	if (ret)
-		return ret;
-
-	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
-				 &regs,
-				 (PT_TSR + 1) * sizeof(long),
-				 PT_CSR * sizeof(long));
-	if (ret)
-		return ret;
-
-	ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-					PT_CSR * sizeof(long),
-					(PT_CSR + 1) * sizeof(long));
-	if (ret)
-		return ret;
-
-	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
-				 &regs,
-				 (PT_CSR + 1) * sizeof(long), -1);
-	return ret;
-}
-
 enum c6x_regset {
 	REGSET_GPR,
 };
@@ -120,7 +80,6 @@ static const struct user_regset c6x_regs
 		.size = sizeof(u32),
 		.align = sizeof(u32),
 		.get = gpr_get,
-		.set = gpr_set
 	},
 };
 

[toc] | [prev] | [next] | [standalone]


#1612854 — [PATCH 4.4 03/14] xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-03-30 12:10 +0200
Subject[PATCH 4.4 03/14] xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder
Message-ID<tqFbK-4Hn-73@gated-at.bofh.it>
In reply to#1612847
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andy Whitcroft <apw@canonical.com>

commit f843ee6dd019bcece3e74e76ad9df0155655d0df upstream.

Kees Cook has pointed out that xfrm_replay_state_esn_len() is subject to
wrapping issues.  To ensure we are correctly ensuring that the two ESN
structures are the same size compare both the overall size as reported
by xfrm_replay_state_esn_len() and the internal length are the same.

CVE-2017-7184
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/xfrm/xfrm_user.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -412,7 +412,11 @@ static inline int xfrm_replay_verify_len
 	up = nla_data(rp);
 	ulen = xfrm_replay_state_esn_len(up);
 
-	if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen)
+	/* Check the overall length and the internal bitmap length to avoid
+	 * potential overflow. */
+	if (nla_len(rp) < ulen ||
+	    xfrm_replay_state_esn_len(replay_esn) != ulen ||
+	    replay_esn->bmp_len != up->bmp_len)
 		return -EINVAL;
 
 	if (up->replay_window > up->bmp_len * sizeof(__u32) * 8)

[toc] | [prev] | [next] | [standalone]


#1613373

FromShuah Khan <shuahkh@osg.samsung.com>
Date2017-03-30 21:00 +0200
Message-ID<tqNsC-2b6-11@gated-at.bofh.it>
In reply to#1612847
On 03/30/2017 03:58 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.59 release.
> There are 14 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Sat Apr  1 09:49:26 UTC 2017.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.59-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

[toc] | [prev] | [next] | [standalone]


#1613607

FromGuenter Roeck <linux@roeck-us.net>
Date2017-03-31 05:50 +0200
Message-ID<tqVJv-7zL-7@gated-at.bofh.it>
In reply to#1612847
On 03/30/2017 02:58 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.59 release.
> There are 14 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Sat Apr  1 09:49:26 UTC 2017.
> Anything received after that time might be too late.
>

Build results:
	total: 149 pass: 149 fail: 0
Qemu test results:
	total: 115 pass: 115 fail: 0

Details are available at http://kerneltests.org/builders.

Guenter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web