stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>, <stable@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 3/4] arm64: Fix the hw_breakpoint range check
Date: Sun, 24 Nov 2013 11:32:50 +0100	[thread overview]
Message-ID: <1385289171-3411-4-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1385289171-3411-1-git-send-email-fweisbec@gmail.com>

From: Oleg Nesterov <oleg@redhat.com>

arch_check_bp_in_kernelspace() tries to avoid the overflow and does 2
TASK_SIZE checks but it needs OR, not AND. Consider va = TASK_SIZE -1
and len = 2 case.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Fixes: 478fcb2cdb2351dcfc3fb23f42d76f4436ee4149
Cc: <stable@vger.kernel.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 arch/arm64/kernel/hw_breakpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index ff516f6..4bbbfde 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -293,7 +293,7 @@ int arch_check_bp_in_kernelspace(struct perf_event *bp)
 	va = info->address;
 	len = get_hbp_len(info->ctrl.len);
 
-	return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE);
+	return (va >= TASK_SIZE) || ((va + len - 1) >= TASK_SIZE);
 }
 
 /*
-- 
1.8.3.1


  parent reply	other threads:[~2013-11-24 10:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-24 10:32 [PATCH 0/4] hw_breakpoints: Fix a bunch of adress range fixes Frederic Weisbecker
2013-11-24 10:32 ` [PATCH 1/4] arm: Fix the hw_breakpoint range check Frederic Weisbecker
2013-11-24 10:32 ` [PATCH 2/4] x86: " Frederic Weisbecker
2013-11-24 13:40   ` Borislav Petkov
2013-11-25 19:50     ` Oleg Nesterov
2013-11-25 20:11       ` Borislav Petkov
2013-11-26 18:09         ` Oleg Nesterov
2013-11-24 10:32 ` Frederic Weisbecker [this message]
2013-11-24 10:32 ` [PATCH 4/4] sh: Fix hw_breakpoint the " Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1385289171-3411-4-git-send-email-fweisbec@gmail.com \
    --to=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).