Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1299898
| Path | csiph.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] s390: fix normalization bug in exception table sorting |
| Date | Fri, 01 Jan 2016 13:40:02 +0100 |
| Message-ID | <qM79U-2rl-5@gated-at.bofh.it> (permalink) |
| X-Original-To | schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=3hD3/MkBpu4lMgzyowoliyTYa7CxJ5+XexHCmbEE6ec=; b=TjhakenY7BWenTJhmt05x5zuqCtCgRKNQHGha286jSPwCS2mPGZEKLPKLJfoqJrkhs sUymrHpyjAyC6LGrvgbpeeBLuHFm8uzz25KvVgdMr0Gl+//5E+x4z7Q8c+CBvjO2bnO0 LKcW9TwuSRBRoF5QYTg7Od1ijlOdIEUnB5fqA= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3hD3/MkBpu4lMgzyowoliyTYa7CxJ5+XexHCmbEE6ec=; b=IognEbK2wUSmRHQctfdMiNZ9Z/vMKJ+cS1jDNQWwFusMrmL0dIr+CNcVpwfqjPhYRb 5lXSVjbgFUUse95oFUZNJ4c31bmWZioMinHoq2zbKVzZBGQpHK/d5hz/V7b4LVfs2mJY WpZ4V5eUZITGKrjEvhaVwU1XsW10XZrG6cjAnHJ61wK5H4adVwxVcDPsJUF9WFyYV/Dg dxawl1K/kF64o1e+konk5WPMb8pptR8AKSp03In3+qeXzou2ifTuRQGBQISWP8FcXaEX Q3QzD4RpOWRM0HFX0Dbl1SNKtKwK0KQTLrhCf/wxwN2+T1ysfo9rIs7AwDqdUgXWfHka oPNw== |
| X-Gm-Message-State | ALoCoQnuvk0vbwobCdURKLF+UpX5VI8bBW2MBncKnKxlVdbKOllgklNjeji4z+nwMUKIvhGDZE1vSplhD6+71O9HfsifEuxLzg== |
| X-Received | by 10.194.116.97 with SMTP id jv1mr81134510wjb.38.1451651976445; Fri, 01 Jan 2016 04:39:36 -0800 (PST) |
| X-Mailer | git-send-email 1.9.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 54 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
| X-Original-Date | Fri, 1 Jan 2016 13:39:22 +0100 |
| X-Original-Message-ID | <1451651962-4180-1-git-send-email-ard.biesheuvel@linaro.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1299898 |
Show key headers only | View raw
The normalization pass in the sorting routine of the relative exception
table serves two purposes:
- it ensures that the address fields of the exception table entries are
fully ordered, so that no ambiguities arise between entries with
identical instruction offsets (i.e., when two instructions that are
exactly 8 bytes apart each have an exception table entry associated with
them)
- it ensures that the offsets of both the instruction and the fixup fields
of each entry are relative to their final location after sorting.
Commit eb608fb366de ("s390/exceptions: switch to relative exception table
entries") ported the relative exception table format from x86, but modified
the sorting routine to only normalize the instruction offset field and not
the fixup offset field. The result is that the fixup offset of each entry
will be relative to the original location of the entry before sorting,
likely leading to crashes when those entries are dereferenced.
Fixes: eb608fb366de ("s390/exceptions: switch to relative exception table entries")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/s390/mm/extable.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/s390/mm/extable.c b/arch/s390/mm/extable.c
index 4d1ee88864e8..18c8b819b0aa 100644
--- a/arch/s390/mm/extable.c
+++ b/arch/s390/mm/extable.c
@@ -52,12 +52,16 @@ void sort_extable(struct exception_table_entry *start,
int i;
/* Normalize entries to being relative to the start of the section */
- for (p = start, i = 0; p < finish; p++, i += 8)
+ for (p = start, i = 0; p < finish; p++, i += 8) {
p->insn += i;
+ p->fixup += i + 4;
+ }
sort(start, finish - start, sizeof(*start), cmp_ex, NULL);
/* Denormalize all entries */
- for (p = start, i = 0; p < finish; p++, i += 8)
+ for (p = start, i = 0; p < finish; p++, i += 8) {
p->insn -= i;
+ p->fixup -= i + 4;
+ }
}
#ifdef CONFIG_MODULES
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] s390: fix normalization bug in exception table sorting Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-01 13:40 +0100 Re: [PATCH] s390: fix normalization bug in exception table sorting Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-01-04 10:50 +0100 Re: [PATCH] s390: fix normalization bug in exception table sorting Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-01-04 10:50 +0100
csiph-web