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 2/4] x86: Fix the hw_breakpoint range check
Date: Sun, 24 Nov 2013 11:32:49 +0100 [thread overview]
Message-ID: <1385289171-3411-3-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.
Note: TASK_SIZE doesn't look right at least on x86, I think it should
be replaced by TASK_SIZE_MAX.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Fixes: 0067f1297241ea567f2b22a455519752d70fcca9
Cc: <stable@vger.kernel.org>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
arch/x86/kernel/hw_breakpoint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index f66ff16..1131c1f 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -200,7 +200,7 @@ int arch_check_bp_in_kernelspace(struct perf_event *bp)
va = info->address;
len = get_hbp_len(info->len);
- return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE);
+ return (va >= TASK_SIZE) || ((va + len - 1) >= TASK_SIZE);
}
int arch_bp_generic_fields(int x86_len, int x86_type,
--
1.8.3.1
next prev 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 ` Frederic Weisbecker [this message]
2013-11-24 13:40 ` [PATCH 2/4] x86: " 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 ` [PATCH 3/4] arm64: " Frederic Weisbecker
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-3-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).